CLI improvements to find and list.
This commit is contained in:
parent
11cffff943
commit
fdc6081244
@ -40,12 +40,15 @@
|
|||||||
|
|
||||||
def setup_parser(subparser):
|
def setup_parser(subparser):
|
||||||
format_group = subparser.add_mutually_exclusive_group()
|
format_group = subparser.add_mutually_exclusive_group()
|
||||||
|
format_group.add_argument(
|
||||||
|
'-l', '--long', action='store_true', dest='long',
|
||||||
|
help='Show dependency hashes as well as versions.')
|
||||||
format_group.add_argument(
|
format_group.add_argument(
|
||||||
'-p', '--paths', action='store_true', dest='paths',
|
'-p', '--paths', action='store_true', dest='paths',
|
||||||
help='Show paths to package install directories')
|
help='Show paths to package install directories')
|
||||||
format_group.add_argument(
|
format_group.add_argument(
|
||||||
'-l', '--long', action='store_true', dest='full_specs',
|
'-d', '--deps', action='store_true', dest='full_deps',
|
||||||
help='Show full-length specs of installed packages')
|
help='Show full dependency DAG of installed packages')
|
||||||
|
|
||||||
subparser.add_argument(
|
subparser.add_argument(
|
||||||
'query_specs', nargs=argparse.REMAINDER,
|
'query_specs', nargs=argparse.REMAINDER,
|
||||||
@ -88,7 +91,7 @@ def find(parser, args):
|
|||||||
specs = index[(architecture,compiler)]
|
specs = index[(architecture,compiler)]
|
||||||
specs.sort()
|
specs.sort()
|
||||||
|
|
||||||
abbreviated = [s.format('$_$@$+$#', color=True) for s in specs]
|
abbreviated = [s.format('$_$@$+', color=True) for s in specs]
|
||||||
if args.paths:
|
if args.paths:
|
||||||
# Print one spec per line along with prefix path
|
# Print one spec per line along with prefix path
|
||||||
width = max(len(s) for s in abbreviated)
|
width = max(len(s) for s in abbreviated)
|
||||||
@ -98,8 +101,11 @@ def find(parser, args):
|
|||||||
for abbrv, spec in zip(abbreviated, specs):
|
for abbrv, spec in zip(abbreviated, specs):
|
||||||
print format % (abbrv, spec.prefix)
|
print format % (abbrv, spec.prefix)
|
||||||
|
|
||||||
elif args.full_specs:
|
elif args.full_deps:
|
||||||
for spec in specs:
|
for spec in specs:
|
||||||
print spec.tree(indent=4, format='$_$@$+', color=True),
|
print spec.tree(indent=4, format='$_$@$+', color=True),
|
||||||
else:
|
else:
|
||||||
colify(s.format('$-_$@$+$#', color=True) for s in specs)
|
fmt = '$-_$@$+'
|
||||||
|
if args.long:
|
||||||
|
fmt += '$#'
|
||||||
|
colify(s.format(fmt, color=True) for s in specs)
|
||||||
|
@ -61,5 +61,4 @@ def match(p, f):
|
|||||||
indent=0
|
indent=0
|
||||||
if sys.stdout.isatty():
|
if sys.stdout.isatty():
|
||||||
tty.msg("%d packages." % len(sorted_packages))
|
tty.msg("%d packages." % len(sorted_packages))
|
||||||
indent=2
|
|
||||||
colify(sorted_packages, indent=indent)
|
colify(sorted_packages, indent=indent)
|
||||||
|
Loading…
Reference in New Issue
Block a user