mirror of
https://github.com/derrod/legendary.git
synced 2024-09-29 08:52:11 +13:00
Update cli.py
This commit is contained in:
parent
87b01b77d8
commit
f00d0b6eb1
1 changed files with 7 additions and 1 deletions
|
@ -371,10 +371,14 @@ class LegendaryCLI:
|
||||||
|
|
||||||
if args.install_tag:
|
if args.install_tag:
|
||||||
files = [fm for fm in files if args.install_tag in fm.install_tags]
|
files = [fm for fm in files if args.install_tag in fm.install_tags]
|
||||||
|
if args.hashlistfile:
|
||||||
|
for fm in files:
|
||||||
|
with open(args.hashlistfile+".sha1", "a") as f:
|
||||||
|
print(f'{fm.hash.hex()} *{fm.filename}', file=f)
|
||||||
if args.hashlist:
|
if args.hashlist:
|
||||||
for fm in files:
|
for fm in files:
|
||||||
print(f'{fm.hash.hex()} *{fm.filename}')
|
print(f'{fm.hash.hex()} *{fm.filename}')
|
||||||
|
|
||||||
elif args.csv or args.tsv:
|
elif args.csv or args.tsv:
|
||||||
writer = csv.writer(stdout, dialect='excel-tab' if args.tsv else 'excel', lineterminator='\n')
|
writer = csv.writer(stdout, dialect='excel-tab' if args.tsv else 'excel', lineterminator='\n')
|
||||||
writer.writerow(['path', 'hash', 'size', 'install_tags'])
|
writer.writerow(['path', 'hash', 'size', 'install_tags'])
|
||||||
|
@ -2795,6 +2799,8 @@ def main():
|
||||||
list_files_parser.add_argument('--json', dest='json', action='store_true', help='Output in JSON format')
|
list_files_parser.add_argument('--json', dest='json', action='store_true', help='Output in JSON format')
|
||||||
list_files_parser.add_argument('--hashlist', dest='hashlist', action='store_true',
|
list_files_parser.add_argument('--hashlist', dest='hashlist', action='store_true',
|
||||||
help='Output file hash list in hashcheck/sha1sum -c compatible format')
|
help='Output file hash list in hashcheck/sha1sum -c compatible format')
|
||||||
|
list_files_parser.add_argument('--hashlistfile', dest='hashlistfile', action='store', metavar='<path>',
|
||||||
|
help='Output file hash list in hashcheck/sha1sum -c compatible format')
|
||||||
list_files_parser.add_argument('--install-tag', dest='install_tag', action='store', metavar='<tag>',
|
list_files_parser.add_argument('--install-tag', dest='install_tag', action='store', metavar='<tag>',
|
||||||
type=str, help='Show only files with specified install tag')
|
type=str, help='Show only files with specified install tag')
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue