[PATCH] show value requirement and plurality of option in online help
FUJIWARA Katsunori
fujiwara at ascade.co.jp
Fri Feb 13 17:33:49 UTC 2009
# HG changeset patch
# User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
# Date 1234546267 -32400
# Node ID 8fdbf004430f226858d706883e4c8178b55ffb90
# Parent cba4db8f408e05f84049888c1cbd32e16284fc78
show value requirement and plurality 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, and plurality is allowed
each kinds are shown as below:
-f --force force push
-e --ssh VAL specify ssh command to use
-r --rev VAL ... a specific revision up to which you would like to push
diff -r cba4db8f408e -r 8fdbf004430f mercurial/commands.py
--- a/mercurial/commands.py Sat Feb 14 01:56:34 2009 +0900
+++ b/mercurial/commands.py Sat Feb 14 02:31:07 2009 +0900
@@ -1487,8 +1487,13 @@
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),
+ addendum = ((isinstance(default, list) and ' VAL ...') or
+ (((default is not None) and
+ not isinstance(default, bool)) and ' VAL') or
+ '')
+ opt_output.append(("%2s%s" %
+ (shortopt and "-%s" % shortopt,
+ longopt and " --%s%s" % (longopt, addendum)),
"%s%s" % (desc,
default
and _(" (default: %s)") % default
diff -r cba4db8f408e -r 8fdbf004430f tests/test-convert.out
--- a/tests/test-convert.out Sat Feb 14 01:56:34 2009 +0900
+++ b/tests/test-convert.out Sat Feb 14 02:31:07 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 VAL username mapping filename
+ -d --dest-type VAL destination repository type
+ --filemap VAL remap file names using contents of file
+ -r --rev VAL import up to target revision REV
+ -s --source-type VAL source repository type
+ --splicemap VAL 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 cba4db8f408e -r 8fdbf004430f tests/test-dispatch.out
--- a/tests/test-dispatch.out Sat Feb 14 01:56:34 2009 +0900
+++ b/tests/test-dispatch.out Sat Feb 14 02:31:07 2009 +0900
@@ -19,11 +19,11 @@
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 VAL print output to file with formatted name
+ -r --rev VAL print the given revision
+ --decode apply any matching decode filter
+ -I --include VAL ... include names matching the given patterns
+ -X --exclude VAL ... exclude names matching the given patterns
use "hg -v help cat" to show global options
% [defaults]
diff -r cba4db8f408e -r 8fdbf004430f tests/test-extdiff.out
--- a/tests/test-extdiff.out Sat Feb 14 01:56:34 2009 +0900
+++ b/tests/test-extdiff.out Sat Feb 14 02:31:07 2009 +0900
@@ -18,10 +18,10 @@
options:
- -o --option pass option to comparison program
- -r --rev revision
- -I --include include names matching the given patterns
- -X --exclude exclude names matching the given patterns
+ -o --option VAL ... pass option to comparison program
+ -r --rev VAL ... revision
+ -I --include VAL ... include names matching the given patterns
+ -X --exclude VAL ... exclude names matching the given patterns
use "hg -v help falabala" to show global options
diffing a.8a5febb7f867/a a.34eed99112ab/a
diff -r cba4db8f408e -r 8fdbf004430f tests/test-extension.out
--- a/tests/test-extension.out Sat Feb 14 01:56:34 2009 +0900
+++ b/tests/test-extension.out Sat Feb 14 02:31:07 2009 +0900
@@ -38,22 +38,22 @@
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 VAL repository root directory or symbolic path name
+ --cwd VAL change working directory
+ -y --noninteractive do not prompt, assume 'yes' for any required answers
+ -q --quiet suppress output
+ -v --verbose enable additional output
+ --config VAL ... set/override config option
+ --debug enable debugging output
+ --debugger start debugger
+ --encoding VAL set the charset encoding (default: ascii)
+ --encodingmode VAL 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
% issue811
% show extensions
debugissue811
diff -r cba4db8f408e -r 8fdbf004430f tests/test-help.out
--- a/tests/test-help.out Sat Feb 14 01:56:34 2009 +0900
+++ b/tests/test-help.out Sat Feb 14 02:31:07 2009 +0900
@@ -173,9 +173,9 @@
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 VAL ... include names matching the given patterns
+ -X --exclude VAL ... exclude names matching the given patterns
+ -n --dry-run do not perform actions, just print output
use "hg -v help add" to show global options
hg add: option --skjdfks not recognized
@@ -192,9 +192,9 @@
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 VAL ... include names matching the given patterns
+ -X --exclude VAL ... exclude names matching the given patterns
+ -n --dry-run do not perform actions, just print output
use "hg -v help add" to show global options
hg diff [OPTION]... [-r REV1 [-r REV2]] [FILE]...
@@ -224,8 +224,8 @@
options:
- -r --rev revision
- -c --change change made by revision
+ -r --rev VAL ... revision
+ -c --change VAL 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 +233,9 @@
-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 VAL number of lines of context to show
+ -I --include VAL ... include names matching the given patterns
+ -X --exclude VAL ... exclude names matching the given patterns
use "hg -v help diff" to show global options
hg status [OPTION]... [FILE]...
@@ -273,20 +273,20 @@
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 VAL ... show difference from revision
+ -I --include VAL ... include names matching the given patterns
+ -X --exclude VAL ... exclude names matching the given patterns
use "hg -v help status" to show global options
hg status [OPTION]... [FILE]...
diff -r cba4db8f408e -r 8fdbf004430f tests/test-qrecord.out
--- a/tests/test-qrecord.out Sat Feb 14 01:56:34 2009 +0900
+++ b/tests/test-qrecord.out Sat Feb 14 02:31:07 2009 +0900
@@ -31,16 +31,16 @@
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 VAL add "From: <given user>" to patch
+ -D --currentdate add "Date: <current date>" to patch
+ -d --date VAL add "Date: <given date>" to patch
+ -I --include VAL ... include names matching the given patterns
+ -X --exclude VAL ... exclude names matching the given patterns
+ -m --message VAL use <text> as commit message
+ -l --logfile VAL read commit message from <file>
use "hg -v help qrecord" to show global options
% base commit
diff -r cba4db8f408e -r 8fdbf004430f tests/test-rebase-parameters.out
--- a/tests/test-rebase-parameters.out Sat Feb 14 01:56:34 2009 +0900
+++ b/tests/test-rebase-parameters.out Sat Feb 14 02:31:07 2009 +0900
@@ -17,14 +17,14 @@
--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
+ -s --source VAL rebase from a given revision
+ -b --base VAL rebase from the base of a given revision
+ -d --dest VAL 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
+ --style VAL display using template map file
+ --template VAL display with template
use "hg -v help rebase" to show global options
@@ -45,14 +45,14 @@
--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
+ -s --source VAL rebase from a given revision
+ -b --base VAL rebase from the base of a given revision
+ -d --dest VAL 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
+ --style VAL display using template map file
+ --template VAL display with template
use "hg -v help rebase" to show global options
@@ -73,14 +73,14 @@
--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
+ -s --source VAL rebase from a given revision
+ -b --base VAL rebase from the base of a given revision
+ -d --dest VAL 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
+ --style VAL display using template map file
+ --template VAL display with template
use "hg -v help rebase" to show global options
@@ -101,14 +101,14 @@
--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
+ -s --source VAL rebase from a given revision
+ -b --base VAL rebase from the base of a given revision
+ -d --dest VAL 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
+ --style VAL display using template map file
+ --template VAL display with template
use "hg -v help rebase" to show global options
diff -r cba4db8f408e -r 8fdbf004430f tests/test-record.out
--- a/tests/test-record.out Sat Feb 14 01:56:34 2009 +0900
+++ b/tests/test-record.out Sat Feb 14 02:31:07 2009 +0900
@@ -27,14 +27,14 @@
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 VAL ... include names matching the given patterns
+ -X --exclude VAL ... exclude names matching the given patterns
+ -m --message VAL use <text> as commit message
+ -l --logfile VAL read commit message from <file>
+ -d --date VAL record datecode as commit date
+ -u --user VAL record user as committer
use "hg -v help record" to show global options
% select no files
More information about the Mercurial-devel
mailing list