Inline subparser for command articles

master
Felix Stupp 2 years ago
parent ead0f08bec
commit caba593ef3
Signed by: zocker
GPG Key ID: 93E1BD26F6B02FB7

@ -22,16 +22,6 @@ def func_articles(server, args):
else:
print(json.dumps([h.toJson() for h in headlines]))
def parser_articles(sub):
p = sub.add_parser('articles', help="Get articles")
p.set_defaults(func=func_articles)
p.add_argument('--feed-id', dest='feed_id', help="Only output articles for this feed, cannot be used with --cat-id")
p.add_argument('--cat-id', dest='cat_id', help="Only output articles for feeds of this category, cannot be used with --feed-id")
p.add_argument('--limit', dest='limit', type=int, help="Maximum count of articles")
p.add_argument('--skip', '--offset', dest='skip', type=int, help="Skip this amount of feeds first")
p.add_argument('--view-mode', '--filter', dest='view_mode', choices=['all_articles', 'unread', 'adaptive', 'marked', 'updated'], default='all_articles', help='Only show articles of certain type')
p.add_argument('--only-url', dest='only_url', action='store_true', help="Only output urls of articles instead of full article info")
def configure_parser():
parser = argparse.ArgumentParser(description="Allows access to feeds and articles of a Tiny Tiny RSS instance using the API.")
#parser.add_argument('--proto', '--protocol', dest='proto', default='https', choices=['http', 'https'], help="The protocol used to access the api, defaults to https")
@ -40,7 +30,15 @@ def configure_parser():
parser.add_argument('-p', '--pass', '--password', dest='passwd', help="Password of the user used to access the instance")
parser.add_argument('-P', '--pass-stdin', '--password-stdin', action='store_true', dest='passStdin', help="Read the password for the user used to access the instance from stdin")
sub = parser.add_subparsers(help="Operations", dest='op', description="Operations available to send to server")
parser_articles(sub)
#= Get Articles
p = sub.add_parser('articles', help="Get articles")
p.set_defaults(func=func_articles)
p.add_argument('--feed-id', dest='feed_id', help="Only output articles for this feed, cannot be used with --cat-id")
p.add_argument('--cat-id', dest='cat_id', help="Only output articles for feeds of this category, cannot be used with --feed-id")
p.add_argument('--limit', dest='limit', type=int, help="Maximum count of articles")
p.add_argument('--skip', '--offset', dest='skip', type=int, help="Skip this amount of feeds first")
p.add_argument('--view-mode', '--filter', dest='view_mode', choices=['all_articles', 'unread', 'adaptive', 'marked', 'updated'], default='all_articles', help='Only show articles of certain type')
p.add_argument('--only-url', dest='only_url', action='store_true', help="Only output urls of articles instead of full article info")
return parser
def parse(args):

Loading…
Cancel
Save