Mercurial > public > mercurial-scm > hg
comparison mercurial/fancyopts.py @ 3749:f9567a7fa3b3
additional fixes for issue436
author | Alexis S. L. Carvalho <alexis@cecm.usp.br> |
---|---|
date | Fri, 01 Dec 2006 16:18:16 -0200 |
parents | 86c1d1d35593 |
children | 88803a69b24a |
comparison
equal
deleted
inserted
replaced
3748:7b88bd88f040 | 3749:f9567a7fa3b3 |
---|---|
9 for s, l, d, c in options: | 9 for s, l, d, c in options: |
10 pl = l.replace('-', '_') | 10 pl = l.replace('-', '_') |
11 map['-'+s] = map['--'+l] = pl | 11 map['-'+s] = map['--'+l] = pl |
12 state[pl] = d | 12 state[pl] = d |
13 dt[pl] = type(d) | 13 dt[pl] = type(d) |
14 if not d is None and not callable(d): | 14 if (d is not None and d is not True and d is not False and |
15 not callable(d)): | |
15 if s: s += ':' | 16 if s: s += ':' |
16 if l: l += '=' | 17 if l: l += '=' |
17 if s: short = short + s | 18 if s: short = short + s |
18 if l: long.append(l) | 19 if l: long.append(l) |
19 | 20 |
23 if dt[map[opt]] is type(fancyopts): state[map[opt]](state, map[opt], arg) | 24 if dt[map[opt]] is type(fancyopts): state[map[opt]](state, map[opt], arg) |
24 elif dt[map[opt]] is type(1): state[map[opt]] = int(arg) | 25 elif dt[map[opt]] is type(1): state[map[opt]] = int(arg) |
25 elif dt[map[opt]] is type(''): state[map[opt]] = arg | 26 elif dt[map[opt]] is type(''): state[map[opt]] = arg |
26 elif dt[map[opt]] is type([]): state[map[opt]].append(arg) | 27 elif dt[map[opt]] is type([]): state[map[opt]].append(arg) |
27 elif dt[map[opt]] is type(None): state[map[opt]] = True | 28 elif dt[map[opt]] is type(None): state[map[opt]] = True |
29 elif dt[map[opt]] is type(False): state[map[opt]] = True | |
28 | 30 |
29 return args | 31 return args |
30 | 32 |