iddb: Commands "ioc" and "console" now show multiple results in a table.
Warning, cannot access the index:
_darcs/index: opening of '_darcs/index' failed: permission denied (Permission denied)
diff -rN -u old-bii_scripts/bin/iddb new-bii_scripts/bin/iddb
--- old-bii_scripts/bin/iddb 2022-09-26 06:07:31.452859850 +0200
+++ new-bii_scripts/bin/iddb 2022-09-26 06:07:31.452859850 +0200
@@ -602,19 +602,18 @@
print(" ".join(l))
return
if rest[0] in ("ioc", "console"):
- result= {}
+ result= []
for n in rest[1:]:
sd_key= dbquery.find_sd_key(n)
ioc= dbobj.db_get("id-data.%s.network.ioc" % sd_key)
if rest[0]=="console":
- result[sd_key]= ioc.split(".",1)[0]
+ result.append((sd_key, ioc.split(".",1)[0]))
else:
- result[sd_key]= ioc
+ result.append((sd_key, ioc))
if len(result)==1:
- result= list(result.values())[0]
- print(result)
+ print(result[0][1])
else:
- pprint.pprint(result)
+ console_print_table(result, ("name", rest[0]))
return
if rest[0]== "dump":
d={}
@@ -662,9 +661,13 @@
Show the prefix ("idcpNN") for the given insertion device. NAME is
the same as for command "devicename" above.
console NAME [NAME ...]
- Show the console name for the given insertion device(s).
+ Show the console name for the given insertion device(s). For a single
+ NAME, just print the console name, for more than one NAME print results
+ in a table.
ioc NAME [NAME ...]
- Show the ioc name for the given insertion device(s).
+ Show the ioc name for the given insertion device(s). For a single
+ NAME, just print the console name, for more than one NAME print results
+ in a table.
dump NAME [NAME ...]
Print the StructuredData database for the given insertion device in
python pretty-print format.
patch 56955941a9853fd49d5fc9a2fa8e2cebdc30bfcb
Author: Goetz Pfeiffer <Goetz.Pfeiffer@helmholtz-berlin.de>
Date: Wed Dec 15 08:50:22 CET 2021
* iddb: Commands "ioc" and "console" now show multiple results in a table.
When the commands are used to display the ioc or console property of more than
one insertion device, the results are printed in a proper formatted table. If
the request is only for a single insertion device, just the resulting string is
printed