def parse_args(args, options):
"""Parse arguments from command-line to set options."""
long_opts = ['help', 'oauth', 'followers', 'following', 'api-rate', 'ids']
short_opts = "horgai"
opts, extra_args = getopt(args, short_opts, long_opts)
for opt, arg in opts:
if opt in ('-h', '--help'):
print(__doc__)
raise SystemExit(1)
elif opt in ('-o', '--oauth'):
options['oauth'] = True
elif opt in ('-r', '--followers'):
options['followers'] = True
elif opt in ('-g', '--following'):
options['followers'] = False
elif opt in ('-a', '--api-rate'):
options['api-rate' ] = True
elif opt in ('-i', '--ids'):
options['show_id'] = True
options['extra_args'] = extra_args
评论列表
文章目录