##// END OF EJS Templates
Non-grouping regex for ignore...
Non-grouping regex for ignore -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Non-grouping regex for ignore Suggested by Mark Williamson manifest hash: dfd4686e7ac9f96e79da600edf299ed64213e05d -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) iD8DBQFCzjX3ywK+sNU5EO8RAnc1AJ4/sKzyZJiRs6UzE3uksE2U9rOkVQCeJsZf PhHsNtEt/WyL+v44mBfk8Mk= =e+Qy -----END PGP SIGNATURE-----

File last commit:

r608:d2994b52 default
r652:a54a1c10 default
Show More
fancyopts.py
27 lines | 769 B | text/x-python | PythonLexer
import os, getopt
def fancyopts(args, options, state):
long=[]
short=''
map={}
dt={}
for s, l, d, c in options:
map['-'+s] = map['--'+l]=l
state[l] = d
dt[l] = type(d)
if not d is None and not callable(d): s, l=s+':', l+'='
if s: short = short + s
if l: long.append(l)
opts, args = getopt.getopt(args, short, long)
for opt, arg in opts:
if dt[map[opt]] is type(fancyopts): state[map[opt]](state,map[opt],arg)
elif dt[map[opt]] is type(1): state[map[opt]] = int(arg)
elif dt[map[opt]] is type(''): state[map[opt]] = arg
elif dt[map[opt]] is type([]): state[map[opt]].append(arg)
elif dt[map[opt]] is type(None): state[map[opt]] = 1
return args