Home | History | Annotate | Download | only in Lib

Lines Matching refs:args

56 def getopt(args, shortopts, longopts = []):
57 """getopt(args, options[, long_options]) -> opts, args
59 Parses command line options and parameter list. args is the
88 while args and args[0].startswith('-') and args[0] != '-':
89 if args[0] == '--':
90 args = args[1:]
92 if args[0].startswith('--'):
93 opts, args = do_longs(opts, args[0][2:], longopts, args[1:])
95 opts, args = do_shorts(opts, args[0][1:], shortopts, args[1:])
97 return opts, args
99 def gnu_getopt(args, shortopts, longopts = []):
100 """getopt(args, options[, long_options]) -> opts, args
130 while args:
131 if args[0] == '--':
132 prog_args += args[1:]
135 if args[0][:2] == '--':
136 opts, args = do_longs(opts, args[0][2:], longopts, args[1:])
137 elif args[0][:1] == '-' and args[0] != '-':
138 opts, args = do_shorts(opts, args[0][1:], shortopts, args[1:])
141 prog_args += args
144 prog_args.append(args[0])
145 args = args[1:]
149 def do_longs(opts, opt, longopts, args):
160 if not args:
162 optarg, args = args[0], args[1:]
166 return opts, args
192 def do_shorts(opts, optstring, shortopts, args):
197 if not args:
200 optstring, args = args[0], args[1:]
205 return opts, args