[PATCH] show value requirement and multiple occurrence of option in online help
FUJIWARA Katsunori
fujiwara at ascade.co.jp
Sun May 16 06:10:56 CDT 2010
# HG changeset patch
# User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
# Date 1274007852 -32400
# Node ID 46ffed62714f9396e658c822b13da1062cf350e3
# Parent 6e65b451b62e6b5bf57e5df34e56214c78e762d6
show value requirement and multiple occurrence of option in online help
this helps users to know what kind of option is:
- no value is required(flag option)
- value is required
- value is required, multiple occurrences of this option are additive
each kinds are shown as below:
-f --force force push
-e --ssh VALUE specify ssh command to use
-r --rev VALUE [+] a specific revision up to which you would like to push
if one or more 3rd type options are shown, explanation for '[+]' mark
is also shown as footnote.
diff -r 6e65b451b62e -r 46ffed62714f mercurial/commands.py
--- a/mercurial/commands.py Sat May 15 21:24:23 2010 -0500
+++ b/mercurial/commands.py Sun May 16 20:04:12 2010 +0900
@@ -1790,17 +1790,32 @@
# list all option lists
opt_output = []
+ multioccur = False
for title, options in option_lists:
opt_output.append(("\n%s" % title, None))
for shortopt, longopt, default, desc in options:
if _("DEPRECATED") in desc and not ui.verbose:
continue
- opt_output.append(("%2s%s" % (shortopt and "-%s" % shortopt,
- longopt and " --%s" % longopt),
+ if isinstance(default, list):
+ addendum = _(" VALUE [+]")
+ multioccur = True
+ elif (default is not None) and not isinstance(default, bool):
+ addendum = _(" VALUE")
+ else:
+ addendum = ""
+ opt_output.append(("%2s%s" %
+ (shortopt and "-%s" % shortopt,
+ longopt and " --%s%s" % (longopt, addendum)),
"%s%s" % (desc,
default
and _(" (default: %s)") % default
or "")))
+ if multioccur:
+ msg = _("\n[+] multiple occurrences of this option are additive")
+ if ui.verbose and name != 'shortlist':
+ opt_output.append((msg, ()))
+ else:
+ opt_output.insert(-1, (msg, ()))
if not name:
ui.write(_("\nadditional help topics:\n\n"))
diff -r 6e65b451b62e -r 46ffed62714f tests/test-convert.out
--- a/tests/test-convert.out Sat May 15 21:24:23 2010 -0500
+++ b/tests/test-convert.out Sun May 16 20:04:12 2010 +0900
@@ -220,16 +220,16 @@
options:
- -A --authors username mapping filename
- -d --dest-type destination repository type
- --filemap remap file names using contents of file
- -r --rev import up to target revision REV
- -s --source-type source repository type
- --splicemap splice synthesized history into place
- --branchmap change branch names while converting
- --branchsort try to sort changesets by branches
- --datesort try to sort changesets by date
- --sourcesort preserve source changesets order
+ -A --authors VALUE username mapping filename
+ -d --dest-type VALUE destination repository type
+ --filemap VALUE remap file names using contents of file
+ -r --rev VALUE import up to target revision REV
+ -s --source-type VALUE source repository type
+ --splicemap VALUE splice synthesized history into place
+ --branchmap VALUE change branch names while converting
+ --branchsort try to sort changesets by branches
+ --datesort try to sort changesets by date
+ --sourcesort preserve source changesets order
use "hg -v help convert" to show global options
adding a
diff -r 6e65b451b62e -r 46ffed62714f tests/test-dispatch.out
--- a/tests/test-dispatch.out Sat May 15 21:24:23 2010 -0500
+++ b/tests/test-dispatch.out Sun May 16 20:04:12 2010 +0900
@@ -21,11 +21,13 @@
options:
- -o --output print output to file with formatted name
- -r --rev print the given revision
- --decode apply any matching decode filter
- -I --include include names matching the given patterns
- -X --exclude exclude names matching the given patterns
+ -o --output VALUE print output to file with formatted name
+ -r --rev VALUE print the given revision
+ --decode apply any matching decode filter
+ -I --include VALUE [+] include names matching the given patterns
+ -X --exclude VALUE [+] exclude names matching the given patterns
+
+[+] multiple occurrences of this option are additive
use "hg -v help cat" to show global options
% [defaults]
diff -r 6e65b451b62e -r 46ffed62714f tests/test-extdiff.out
--- a/tests/test-extdiff.out Sat May 15 21:24:23 2010 -0500
+++ b/tests/test-extdiff.out Sun May 16 20:04:12 2010 +0900
@@ -17,11 +17,13 @@
options:
- -o --option pass option to comparison program
- -r --rev revision
- -c --change change made by revision
- -I --include include names matching the given patterns
- -X --exclude exclude names matching the given patterns
+ -o --option VALUE [+] pass option to comparison program
+ -r --rev VALUE [+] revision
+ -c --change VALUE change made by revision
+ -I --include VALUE [+] include names matching the given patterns
+ -X --exclude VALUE [+] exclude names matching the given patterns
+
+[+] multiple occurrences of this option are additive
use "hg -v help falabala" to show global options
diffing a.8a5febb7f867/a a.34eed99112ab/a
diff -r 6e65b451b62e -r 46ffed62714f tests/test-extension.out
--- a/tests/test-extension.out Sat May 15 21:24:23 2010 -0500
+++ b/tests/test-extension.out Sun May 16 20:04:12 2010 +0900
@@ -51,21 +51,25 @@
yet another foo command
global options:
- -R --repository repository root directory or name of overlay bundle file
- --cwd change working directory
- -y --noninteractive do not prompt, assume 'yes' for any required answers
- -q --quiet suppress output
- -v --verbose enable additional output
- --config set/override config option (use 'section.name=value')
- --debug enable debugging output
- --debugger start debugger
- --encoding set the charset encoding (default: ascii)
- --encodingmode set the charset encoding mode (default: strict)
- --traceback always print a traceback on exception
- --time time how long the command takes
- --profile print command execution profile
- --version output version information and exit
- -h --help display help and exit
+ -R --repository VALUE repository root directory or name of overlay bundle
+ file
+ --cwd VALUE change working directory
+ -y --noninteractive do not prompt, assume 'yes' for any required answers
+ -q --quiet suppress output
+ -v --verbose enable additional output
+ --config VALUE [+] set/override config option (use
+ 'section.name=value')
+ --debug enable debugging output
+ --debugger start debugger
+ --encoding VALUE set the charset encoding (default: ascii)
+ --encodingmode VALUE set the charset encoding mode (default: strict)
+ --traceback always print a traceback on exception
+ --time time how long the command takes
+ --profile print command execution profile
+ --version output version information and exit
+ -h --help display help and exit
+
+[+] multiple occurrences of this option are additive
% hg help --debug
debugextension extension - only debugcommands
@@ -77,21 +81,25 @@
yet another foo command
global options:
- -R --repository repository root directory or name of overlay bundle file
- --cwd change working directory
- -y --noninteractive do not prompt, assume 'yes' for any required answers
- -q --quiet suppress output
- -v --verbose enable additional output
- --config set/override config option (use 'section.name=value')
- --debug enable debugging output
- --debugger start debugger
- --encoding set the charset encoding (default: ascii)
- --encodingmode set the charset encoding mode (default: strict)
- --traceback always print a traceback on exception
- --time time how long the command takes
- --profile print command execution profile
- --version output version information and exit
- -h --help display help and exit
+ -R --repository VALUE repository root directory or name of overlay bundle
+ file
+ --cwd VALUE change working directory
+ -y --noninteractive do not prompt, assume 'yes' for any required answers
+ -q --quiet suppress output
+ -v --verbose enable additional output
+ --config VALUE [+] set/override config option (use
+ 'section.name=value')
+ --debug enable debugging output
+ --debugger start debugger
+ --encoding VALUE set the charset encoding (default: ascii)
+ --encodingmode VALUE set the charset encoding mode (default: strict)
+ --traceback always print a traceback on exception
+ --time time how long the command takes
+ --profile print command execution profile
+ --version output version information and exit
+ -h --help display help and exit
+
+[+] multiple occurrences of this option are additive
% issue811
% show extensions
debugissue811
diff -r 6e65b451b62e -r 46ffed62714f tests/test-help.out
--- a/tests/test-help.out Sat May 15 21:24:23 2010 -0500
+++ b/tests/test-help.out Sun May 16 20:04:12 2010 +0900
@@ -217,21 +217,25 @@
update working directory (or switch revisions)
global options:
- -R --repository repository root directory or name of overlay bundle file
- --cwd change working directory
- -y --noninteractive do not prompt, assume 'yes' for any required answers
- -q --quiet suppress output
- -v --verbose enable additional output
- --config set/override config option (use 'section.name=value')
- --debug enable debugging output
- --debugger start debugger
- --encoding set the charset encoding (default: ascii)
- --encodingmode set the charset encoding mode (default: strict)
- --traceback always print a traceback on exception
- --time time how long the command takes
- --profile print command execution profile
- --version output version information and exit
- -h --help display help and exit
+ -R --repository VALUE repository root directory or name of overlay bundle
+ file
+ --cwd VALUE change working directory
+ -y --noninteractive do not prompt, assume 'yes' for any required answers
+ -q --quiet suppress output
+ -v --verbose enable additional output
+ --config VALUE [+] set/override config option (use
+ 'section.name=value')
+ --debug enable debugging output
+ --debugger start debugger
+ --encoding VALUE set the charset encoding (default: ascii)
+ --encodingmode VALUE set the charset encoding mode (default: strict)
+ --traceback always print a traceback on exception
+ --time time how long the command takes
+ --profile print command execution profile
+ --version output version information and exit
+ -h --help display help and exit
+
+[+] multiple occurrences of this option are additive
use "hg help" for the full list of commands
hg add [OPTION]... [FILE]...
@@ -249,9 +253,11 @@
options:
- -I --include include names matching the given patterns
- -X --exclude exclude names matching the given patterns
- -n --dry-run do not perform actions, just print output
+ -I --include VALUE [+] include names matching the given patterns
+ -X --exclude VALUE [+] exclude names matching the given patterns
+ -n --dry-run do not perform actions, just print output
+
+[+] multiple occurrences of this option are additive
use "hg -v help add" to show global options
%% verbose help for add
@@ -280,26 +286,30 @@
options:
- -I --include include names matching the given patterns
- -X --exclude exclude names matching the given patterns
- -n --dry-run do not perform actions, just print output
+ -I --include VALUE [+] include names matching the given patterns
+ -X --exclude VALUE [+] exclude names matching the given patterns
+ -n --dry-run do not perform actions, just print output
global options:
- -R --repository repository root directory or name of overlay bundle file
- --cwd change working directory
- -y --noninteractive do not prompt, assume 'yes' for any required answers
- -q --quiet suppress output
- -v --verbose enable additional output
- --config set/override config option (use 'section.name=value')
- --debug enable debugging output
- --debugger start debugger
- --encoding set the charset encoding (default: ascii)
- --encodingmode set the charset encoding mode (default: strict)
- --traceback always print a traceback on exception
- --time time how long the command takes
- --profile print command execution profile
- --version output version information and exit
- -h --help display help and exit
+ -R --repository VALUE repository root directory or name of overlay bundle
+ file
+ --cwd VALUE change working directory
+ -y --noninteractive do not prompt, assume 'yes' for any required answers
+ -q --quiet suppress output
+ -v --verbose enable additional output
+ --config VALUE [+] set/override config option (use
+ 'section.name=value')
+ --debug enable debugging output
+ --debugger start debugger
+ --encoding VALUE set the charset encoding (default: ascii)
+ --encodingmode VALUE set the charset encoding mode (default: strict)
+ --traceback always print a traceback on exception
+ --time time how long the command takes
+ --profile print command execution profile
+ --version output version information and exit
+ -h --help display help and exit
+
+[+] multiple occurrences of this option are additive
%% test help option with version option
Mercurial Distributed SCM (version xxx)
@@ -322,9 +332,11 @@
options:
- -I --include include names matching the given patterns
- -X --exclude exclude names matching the given patterns
- -n --dry-run do not perform actions, just print output
+ -I --include VALUE [+] include names matching the given patterns
+ -X --exclude VALUE [+] exclude names matching the given patterns
+ -n --dry-run do not perform actions, just print output
+
+[+] multiple occurrences of this option are additive
use "hg -v help add" to show global options
hg add: option --skjdfks not recognized
@@ -343,9 +355,11 @@
options:
- -I --include include names matching the given patterns
- -X --exclude exclude names matching the given patterns
- -n --dry-run do not perform actions, just print output
+ -I --include VALUE [+] include names matching the given patterns
+ -X --exclude VALUE [+] exclude names matching the given patterns
+ -n --dry-run do not perform actions, just print output
+
+[+] multiple occurrences of this option are additive
use "hg -v help add" to show global options
%% test ambiguous command help
@@ -401,8 +415,8 @@
options:
- -r --rev revision
- -c --change change made by revision
+ -r --rev VALUE [+] revision
+ -c --change VALUE change made by revision
-a --text treat all files as text
-g --git use git extended diff format
--nodates omit dates from diff headers
@@ -411,10 +425,12 @@
-w --ignore-all-space ignore white space when comparing lines
-b --ignore-space-change ignore changes in the amount of white space
-B --ignore-blank-lines ignore changes whose lines are all blank
- -U --unified number of lines of context to show
+ -U --unified VALUE number of lines of context to show
--stat output diffstat-style summary of changes
- -I --include include names matching the given patterns
- -X --exclude exclude names matching the given patterns
+ -I --include VALUE [+] include names matching the given patterns
+ -X --exclude VALUE [+] exclude names matching the given patterns
+
+[+] multiple occurrences of this option are additive
use "hg -v help diff" to show global options
hg status [OPTION]... [FILE]...
@@ -457,21 +473,23 @@
options:
- -A --all show status of all files
- -m --modified show only modified files
- -a --added show only added files
- -r --removed show only removed files
- -d --deleted show only deleted (but tracked) files
- -c --clean show only files without changes
- -u --unknown show only unknown (not tracked) files
- -i --ignored show only ignored files
- -n --no-status hide status prefix
- -C --copies show source of copied files
- -0 --print0 end filenames with NUL, for use with xargs
- --rev show difference from revision
- --change list the changed files of a revision
- -I --include include names matching the given patterns
- -X --exclude exclude names matching the given patterns
+ -A --all show status of all files
+ -m --modified show only modified files
+ -a --added show only added files
+ -r --removed show only removed files
+ -d --deleted show only deleted (but tracked) files
+ -c --clean show only files without changes
+ -u --unknown show only unknown (not tracked) files
+ -i --ignored show only ignored files
+ -n --no-status hide status prefix
+ -C --copies show source of copied files
+ -0 --print0 end filenames with NUL, for use with xargs
+ --rev VALUE [+] show difference from revision
+ --change VALUE list the changed files of a revision
+ -I --include VALUE [+] include names matching the given patterns
+ -X --exclude VALUE [+] exclude names matching the given patterns
+
+[+] multiple occurrences of this option are additive
use "hg -v help status" to show global options
hg status [OPTION]... [FILE]...
diff -r 6e65b451b62e -r 46ffed62714f tests/test-qrecord.out
--- a/tests/test-qrecord.out Sat May 15 21:24:23 2010 -0500
+++ b/tests/test-qrecord.out Sun May 16 20:04:12 2010 +0900
@@ -32,16 +32,18 @@
options:
- -e --edit edit commit message
- -g --git use git extended diff format
- -U --currentuser add "From: <current user>" to patch
- -u --user add "From: <given user>" to patch
- -D --currentdate add "Date: <current date>" to patch
- -d --date add "Date: <given date>" to patch
- -I --include include names matching the given patterns
- -X --exclude exclude names matching the given patterns
- -m --message use <text> as commit message
- -l --logfile read commit message from <file>
+ -e --edit edit commit message
+ -g --git use git extended diff format
+ -U --currentuser add "From: <current user>" to patch
+ -u --user VALUE add "From: <given user>" to patch
+ -D --currentdate add "Date: <current date>" to patch
+ -d --date VALUE add "Date: <given date>" to patch
+ -I --include VALUE [+] include names matching the given patterns
+ -X --exclude VALUE [+] exclude names matching the given patterns
+ -m --message VALUE use <text> as commit message
+ -l --logfile VALUE read commit message from <file>
+
+[+] multiple occurrences of this option are additive
use "hg -v help qrecord" to show global options
% base commit
diff -r 6e65b451b62e -r 46ffed62714f tests/test-rebase-parameters.out
--- a/tests/test-rebase-parameters.out Sat May 15 21:24:23 2010 -0500
+++ b/tests/test-rebase-parameters.out Sun May 16 20:04:12 2010 +0900
@@ -44,18 +44,18 @@
options:
- -s --source rebase from the specified changeset
- -b --base rebase from the base of the specified changeset (up to
- greatest common ancestor of base and dest)
- -d --dest rebase onto the specified changeset
- --collapse collapse the rebased changesets
- --keep keep original changesets
- --keepbranches keep original branch names
- --detach force detaching of source from its original branch
- -c --continue continue an interrupted rebase
- -a --abort abort an interrupted rebase
- --style display using template map file
- --template display with template
+ -s --source VALUE rebase from the specified changeset
+ -b --base VALUE rebase from the base of the specified changeset (up to
+ greatest common ancestor of base and dest)
+ -d --dest VALUE rebase onto the specified changeset
+ --collapse collapse the rebased changesets
+ --keep keep original changesets
+ --keepbranches keep original branch names
+ --detach force detaching of source from its original branch
+ -c --continue continue an interrupted rebase
+ -a --abort abort an interrupted rebase
+ --style VALUE display using template map file
+ --template VALUE display with template
use "hg -v help rebase" to show global options
@@ -103,18 +103,18 @@
options:
- -s --source rebase from the specified changeset
- -b --base rebase from the base of the specified changeset (up to
- greatest common ancestor of base and dest)
- -d --dest rebase onto the specified changeset
- --collapse collapse the rebased changesets
- --keep keep original changesets
- --keepbranches keep original branch names
- --detach force detaching of source from its original branch
- -c --continue continue an interrupted rebase
- -a --abort abort an interrupted rebase
- --style display using template map file
- --template display with template
+ -s --source VALUE rebase from the specified changeset
+ -b --base VALUE rebase from the base of the specified changeset (up to
+ greatest common ancestor of base and dest)
+ -d --dest VALUE rebase onto the specified changeset
+ --collapse collapse the rebased changesets
+ --keep keep original changesets
+ --keepbranches keep original branch names
+ --detach force detaching of source from its original branch
+ -c --continue continue an interrupted rebase
+ -a --abort abort an interrupted rebase
+ --style VALUE display using template map file
+ --template VALUE display with template
use "hg -v help rebase" to show global options
@@ -162,18 +162,18 @@
options:
- -s --source rebase from the specified changeset
- -b --base rebase from the base of the specified changeset (up to
- greatest common ancestor of base and dest)
- -d --dest rebase onto the specified changeset
- --collapse collapse the rebased changesets
- --keep keep original changesets
- --keepbranches keep original branch names
- --detach force detaching of source from its original branch
- -c --continue continue an interrupted rebase
- -a --abort abort an interrupted rebase
- --style display using template map file
- --template display with template
+ -s --source VALUE rebase from the specified changeset
+ -b --base VALUE rebase from the base of the specified changeset (up to
+ greatest common ancestor of base and dest)
+ -d --dest VALUE rebase onto the specified changeset
+ --collapse collapse the rebased changesets
+ --keep keep original changesets
+ --keepbranches keep original branch names
+ --detach force detaching of source from its original branch
+ -c --continue continue an interrupted rebase
+ -a --abort abort an interrupted rebase
+ --style VALUE display using template map file
+ --template VALUE display with template
use "hg -v help rebase" to show global options
@@ -221,18 +221,18 @@
options:
- -s --source rebase from the specified changeset
- -b --base rebase from the base of the specified changeset (up to
- greatest common ancestor of base and dest)
- -d --dest rebase onto the specified changeset
- --collapse collapse the rebased changesets
- --keep keep original changesets
- --keepbranches keep original branch names
- --detach force detaching of source from its original branch
- -c --continue continue an interrupted rebase
- -a --abort abort an interrupted rebase
- --style display using template map file
- --template display with template
+ -s --source VALUE rebase from the specified changeset
+ -b --base VALUE rebase from the base of the specified changeset (up to
+ greatest common ancestor of base and dest)
+ -d --dest VALUE rebase onto the specified changeset
+ --collapse collapse the rebased changesets
+ --keep keep original changesets
+ --keepbranches keep original branch names
+ --detach force detaching of source from its original branch
+ -c --continue continue an interrupted rebase
+ -a --abort abort an interrupted rebase
+ --style VALUE display using template map file
+ --template VALUE display with template
use "hg -v help rebase" to show global options
diff -r 6e65b451b62e -r 46ffed62714f tests/test-record.out
--- a/tests/test-record.out Sat May 15 21:24:23 2010 -0500
+++ b/tests/test-record.out Sun May 16 20:04:12 2010 +0900
@@ -26,14 +26,18 @@
options:
- -A --addremove mark new/missing files as added/removed before committing
- --close-branch mark a branch as closed, hiding it from the branch list
- -I --include include names matching the given patterns
- -X --exclude exclude names matching the given patterns
- -m --message use <text> as commit message
- -l --logfile read commit message from <file>
- -d --date record datecode as commit date
- -u --user record the specified user as committer
+ -A --addremove mark new/missing files as added/removed before
+ committing
+ --close-branch mark a branch as closed, hiding it from the branch
+ list
+ -I --include VALUE [+] include names matching the given patterns
+ -X --exclude VALUE [+] exclude names matching the given patterns
+ -m --message VALUE use <text> as commit message
+ -l --logfile VALUE read commit message from <file>
+ -d --date VALUE record datecode as commit date
+ -u --user VALUE record the specified user as committer
+
+[+] multiple occurrences of this option are additive
use "hg -v help record" to show global options
% select no files
More information about the Mercurial-devel
mailing list