def get_opt(argv):
(opts, args) = getopt.gnu_getopt(
argv, 's:r:d:t:', ['source=', 'refspec=', 'destination=', 'timeout=']
)
if args:
args = ','.join(args)
raise Exception('non-dashed options "%s" not recognized' % args)
src = None
dst = None
refspec = None
timeout = 600
for (opt, arg) in opts:
if opt in ['-s', '--source']:
src = arg
elif opt in ['-r', '--refspec']:
refspec = arg
elif opt in ['-d', '--destination']:
dst = arg
elif opt in ['-t', '--timeout']:
timeout = int(arg)
return (src, dst, refspec, timeout)
评论列表
文章目录