obi ls: various improvements
This commit is contained in:
@ -3,7 +3,9 @@
|
||||
from obitools3.uri.decode import open_uri
|
||||
from obitools3.apps.config import logger
|
||||
from obitools3.dms import DMS
|
||||
from obitools3.dms.taxo.taxo cimport Taxonomy
|
||||
from obitools3.apps.optiongroups import addMinimalInputOption
|
||||
from obitools3.utils cimport tostr
|
||||
|
||||
|
||||
__title__="Print a preview of a DMS, view, column...."
|
||||
@ -11,6 +13,12 @@ __title__="Print a preview of a DMS, view, column...."
|
||||
|
||||
def addOptions(parser):
|
||||
addMinimalInputOption(parser)
|
||||
group = parser.add_argument_group('obi ls specific options')
|
||||
|
||||
group.add_argument('-l',
|
||||
action="store_true", dest="ls:longformat",
|
||||
default=False,
|
||||
help="Detailed list in long format with all metadata.")
|
||||
|
||||
|
||||
def run(config):
|
||||
@ -23,6 +31,21 @@ def run(config):
|
||||
input = open_uri(config['obi']['inputURI'])
|
||||
if input is None:
|
||||
raise Exception("Could not read input")
|
||||
|
||||
print(repr(input[1]))
|
||||
if input[2] == DMS and not config['ls']['longformat']:
|
||||
dms = input[0]
|
||||
l = []
|
||||
for view in input[0]:
|
||||
l.append(tostr(view) + "\t(Date created: " + tostr(dms[view].comments["Date created"])+")")
|
||||
l.sort()
|
||||
for v in l:
|
||||
print(v)
|
||||
else:
|
||||
print(repr(input[1]))
|
||||
if input[2] == DMS:
|
||||
print("\n### Taxonomies:")
|
||||
for t in Taxonomy.list_taxos(input[0]):
|
||||
print("\t", tostr(t))
|
||||
if config['ls']['longformat'] and len(input[1].comments) > 0:
|
||||
print("\n### Comments:")
|
||||
print(str(input[1].comments))
|
||||
|
||||
|
Reference in New Issue
Block a user