[PATCH] show value requirement and multiple occurrence of option in online help
FUJIWARA Katsunori
fujiwara at ascade.co.jp
Sat Feb 21 14:21:14 UTC 2009
# HG changeset patch
# User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
# Date 1235225686 -32400
# Node ID d029b27d91c826fc9dc7a10879920dc80de58dfe
# Parent 9915283e8ae2dfca85bbb35f2eb9964e491c7be1
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 9915283e8ae2 -r d029b27d91c8 mercurial/commands.py
--- a/mercurial/commands.py Fri Feb 20 23:48:09 2009 +0900
+++ b/mercurial/commands.py Sat Feb 21 23:14:46 2009 +0900
@@ -1486,16 +1486,31 @@
# list all option lists
opt_output = []
+ multi_occurence = 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 [+]")
+ multi_occurence = 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 multi_occurence:
+ msg = _("\n[+] multiple occurrences of this option are additive")
+ if ui.verbose:
+ opt_output.append((msg, ()))
+ else:
+ opt_output.insert(-1, (msg, ()))
if not name:
ui.write(_("\nadditional help topics:\n\n"))
diff -r 9915283e8ae2 -r d029b27d91c8 tests/test-convert.out
--- a/tests/test-convert.out Fri Feb 20 23:48:09 2009 +0900
+++ b/tests/test-convert.out Sat Feb 21 23:14:46 2009 +0900
@@ -166,13 +166,13 @@
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
- --datesort try to sort changesets by date
+ -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
+ --datesort try to sort changesets by date
use "hg -v help convert" to show global options
adding a
diff -r 9915283e8ae2 -r d029b27d91c8 tests/test-dispatch.out
--- a/tests/test-dispatch.out Fri Feb 20 23:48:09 2009 +0900
+++ b/tests/test-dispatch.out Sat Feb 21 23:14:46 2009 +0900
@@ -19,11 +19,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 9915283e8ae2 -r d029b27d91c8 tests/test-extdiff.out
--- a/tests/test-extdiff.out Fri Feb 20 23:48:09 2009 +0900
+++ b/tests/test-extdiff.out Sat Feb 21 23:14:46 2009 +0900
@@ -18,11 +18,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 9915283e8ae2 -r d029b27d91c8 tests/test-extension.out
--- a/tests/test-extension.out Fri Feb 20 23:48:09 2009 +0900
+++ b/tests/test-extension.out Sat Feb 21 23:14:46 2009 +0900
@@ -38,22 +38,24 @@
debugextension only debugcommands
global options:
- -R --repository repository root directory or symbolic path name
- --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
- --debug enable debugging output
- --debugger start debugger
- --encoding set the charset encoding (default: ascii)
- --encodingmode set the charset encoding mode (default: strict)
- --lsprof print improved command execution profile
- --traceback print 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 symbolic path name
+ --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
+ --debug enable debugging output
+ --debugger start debugger
+ --encoding VALUE set the charset encoding (default: ascii)
+ --encodingmode VALUE set the charset encoding mode (default: strict)
+ --lsprof print improved command execution profile
+ --traceback print 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 9915283e8ae2 -r d029b27d91c8 tests/test-help.out
--- a/tests/test-help.out Fri Feb 20 23:48:09 2009 +0900
+++ b/tests/test-help.out Sat Feb 21 23:14:46 2009 +0900
@@ -173,9 +173,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
@@ -192,9 +194,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 diff [OPTION]... [-r REV1 [-r REV2]] [FILE]...
@@ -224,8 +228,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 don't include dates in diff headers
@@ -233,9 +237,11 @@
-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
- -I --include include names matching the given patterns
- -X --exclude exclude names matching the given patterns
+ -U --unified VALUE number of lines of context to show
+ -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]...
@@ -273,20 +279,22 @@
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
- -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
+ -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 9915283e8ae2 -r d029b27d91c8 tests/test-qrecord.out
--- a/tests/test-qrecord.out Fri Feb 20 23:48:09 2009 +0900
+++ b/tests/test-qrecord.out Sat Feb 21 23:14:46 2009 +0900
@@ -31,16 +31,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 9915283e8ae2 -r d029b27d91c8 tests/test-rebase-parameters.out
--- a/tests/test-rebase-parameters.out Fri Feb 20 23:48:09 2009 +0900
+++ b/tests/test-rebase-parameters.out Sat Feb 21 23:14:46 2009 +0900
@@ -15,16 +15,16 @@
options:
- --keep keep original revisions
- --keepbranches keep original branches
- -s --source rebase from a given revision
- -b --base rebase from the base of a given revision
- -d --dest rebase onto a given revision
- --collapse collapse the rebased revisions
- -c --continue continue an interrupted rebase
- -a --abort abort an interrupted rebase
- --style display using template map file
- --template display with template
+ --keep keep original revisions
+ --keepbranches keep original branches
+ -s --source VALUE rebase from a given revision
+ -b --base VALUE rebase from the base of a given revision
+ -d --dest VALUE rebase onto a given revision
+ --collapse collapse the rebased revisions
+ -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
@@ -43,16 +43,16 @@
options:
- --keep keep original revisions
- --keepbranches keep original branches
- -s --source rebase from a given revision
- -b --base rebase from the base of a given revision
- -d --dest rebase onto a given revision
- --collapse collapse the rebased revisions
- -c --continue continue an interrupted rebase
- -a --abort abort an interrupted rebase
- --style display using template map file
- --template display with template
+ --keep keep original revisions
+ --keepbranches keep original branches
+ -s --source VALUE rebase from a given revision
+ -b --base VALUE rebase from the base of a given revision
+ -d --dest VALUE rebase onto a given revision
+ --collapse collapse the rebased revisions
+ -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
@@ -71,16 +71,16 @@
options:
- --keep keep original revisions
- --keepbranches keep original branches
- -s --source rebase from a given revision
- -b --base rebase from the base of a given revision
- -d --dest rebase onto a given revision
- --collapse collapse the rebased revisions
- -c --continue continue an interrupted rebase
- -a --abort abort an interrupted rebase
- --style display using template map file
- --template display with template
+ --keep keep original revisions
+ --keepbranches keep original branches
+ -s --source VALUE rebase from a given revision
+ -b --base VALUE rebase from the base of a given revision
+ -d --dest VALUE rebase onto a given revision
+ --collapse collapse the rebased revisions
+ -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
@@ -99,16 +99,16 @@
options:
- --keep keep original revisions
- --keepbranches keep original branches
- -s --source rebase from a given revision
- -b --base rebase from the base of a given revision
- -d --dest rebase onto a given revision
- --collapse collapse the rebased revisions
- -c --continue continue an interrupted rebase
- -a --abort abort an interrupted rebase
- --style display using template map file
- --template display with template
+ --keep keep original revisions
+ --keepbranches keep original branches
+ -s --source VALUE rebase from a given revision
+ -b --base VALUE rebase from the base of a given revision
+ -d --dest VALUE rebase onto a given revision
+ --collapse collapse the rebased revisions
+ -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 9915283e8ae2 -r d029b27d91c8 tests/test-record.out
--- a/tests/test-record.out Fri Feb 20 23:48:09 2009 +0900
+++ b/tests/test-record.out Sat Feb 21 23:14:46 2009 +0900
@@ -27,14 +27,16 @@
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 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 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