comparison mercurial/fancyopts.py @ 11321:40c06bbf58be

help: show value requirement and multiple occurrence of options this helps users to know what kind of option is: - no value is required(flag option) - value is required - value is required, and multiple occurrences are allowed each kinds are shown as below: -f --force force push -e --ssh CMD specify ssh command to use -b --branch BRANCH [+] a specific branch you would like to push if one or more 3rd type options are shown, explanation for '[+]' mark is also shown as footnote.
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Sun, 06 Jun 2010 17:25:00 +0900
parents 08a0f04b56bd
children d3bb825ddae3
comparison
equal deleted inserted replaced
11320:e4274f9f97c8 11321:40c06bbf58be
41 41
42 short option or '' 42 short option or ''
43 long option 43 long option
44 default value 44 default value
45 description 45 description
46 option value label(optional)
46 47
47 option types include: 48 option types include:
48 49
49 boolean or none - option sets variable in state to true 50 boolean or none - option sets variable in state to true
50 string - parameter string is stored in state 51 string - parameter string is stored in state
57 namelist = [] 58 namelist = []
58 shortlist = '' 59 shortlist = ''
59 argmap = {} 60 argmap = {}
60 defmap = {} 61 defmap = {}
61 62
62 for short, name, default, comment in options: 63 for option in options:
64 if len(option) == 5:
65 short, name, default, comment, dummy = option
66 else:
67 short, name, default, comment = option
63 # convert opts to getopt format 68 # convert opts to getopt format
64 oname = name 69 oname = name
65 name = name.replace('-', '_') 70 name = name.replace('-', '_')
66 71
67 argmap['-' + short] = argmap['--' + oname] = name 72 argmap['-' + short] = argmap['--' + oname] = name