ENTRY_LIST=Path.home() / ".local" / "share" / "nom" / "entrylist" / "default"
def cli():
+
+ # Label Parser
+ label_parser = ArgumentParser(add_help=False)
+ label_parser.add_argument('label', nargs='*', type=int)
+
+ # Main Parser
parser = ArgumentParser(description="Nom Script")
subparsers = parser.add_subparsers(dest='command', help='Sub-command help')
# Entry subcommand
entry_parser = subparsers.add_parser('entry', help='Dispatches commands that operate on a table of entries.')
entry_subparsers = entry_parser.add_subparsers(dest='entry_command', help='Dispatches entry commands.')
- entry_show_parser = entry_subparsers.add_parser('show', help='Show entries.')
+ entry_show_parser = entry_subparsers.add_parser('show', parents=[label_parser], help='Show entries.')
entry_update_parser = entry_subparsers.add_parser('update', help='Update entry data.')
# Feed subcommand
feed_subparsers = feed_parser.add_subparsers(dest='feed_command', help='Dispatches feed commands.')
feed_update_parser = feed_subparsers.add_parser('update', help='Update feed')
feed_show_parser = feed_subparsers.add_parser('show', help='Show feeds')
-
return parser
elist.to_csv(ENTRY_LIST)
elif args.command == "entry" and args.entry_command == "show":
elist = EntryList.from_csv(ENTRY_LIST)
+ if args.label:
+ elist = elist.select(lambda e: e.label in args.label)
elist.to_stdout(show_header=True)
elif args.command == "feed" and args.feed_command == "update":
feedlist.update_labels()
main(args='entry show'.split(' '))
assert True
+def test_nom_entry_show_one():
+ main(args='entry show 1'.split(' '))
+ assert True
+
def test_nom_feed_update():
main(args='feed update'.split(' '))
assert True