File tree Expand file tree Collapse file tree 4 files changed +11
-7
lines changed Expand file tree Collapse file tree 4 files changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -31,6 +31,8 @@ Unreleased
31
31
making checksums less visually distracting. The old hex format will still be
32
32
accepted, but will be updated to the new format automatically when writing.
33
33
34
+ - Added ``--help `` option as an alias for ``-h ``.
35
+
34
36
- Dropped support for Python 3.7 and 3.8, and added 3.13.
35
37
36
38
Original file line number Diff line number Diff line change 60
60
--verbosity=VERBOSITY
61
61
Control the amount of output. 2 (the default) lists all files,
62
62
1 lists only changed files, 0 lists no files.
63
- -h Print this help.
63
+ -h, --help Print this help.
64
64
"""
65
65
66
66
@@ -775,7 +775,7 @@ def callable_main(self, argv):
775
775
argv = argv [1 :]
776
776
777
777
# Provide help if asked for anywhere in the command line.
778
- if "-?" in argv or "-h" in argv :
778
+ if "-?" in argv or "-h" in argv or "--help" in argv :
779
779
self .prerr (usage , end = "" )
780
780
return
781
781
@@ -804,7 +804,7 @@ def main(self, argv):
804
804
return 0
805
805
except CogUsageError as err :
806
806
self .prerr (err )
807
- self .prerr ("(for help use -h )" )
807
+ self .prerr ("(for help use --help )" )
808
808
return 2
809
809
except CogGeneratedError as err :
810
810
self .prerr (f"Error: { err } " )
Original file line number Diff line number Diff line change @@ -843,10 +843,12 @@ def produces_help(self, args):
843
843
self .assertEqual (usage , self .output .getvalue ())
844
844
845
845
def test_dash_h (self ):
846
- # -h or -? anywhere on the command line should just print help.
846
+ # -h, --help, or -? anywhere on the command line should just print help.
847
847
self .produces_help ("-h" )
848
+ self .produces_help ("--help" )
848
849
self .produces_help ("-?" )
849
850
self .produces_help ("fooey.txt -h" )
851
+ self .produces_help ("fooey.txt --help" )
850
852
self .produces_help ("-o -r @fooey.txt -? @booey.txt" )
851
853
852
854
def test_dash_o_and_dash_r (self ):
@@ -931,7 +933,7 @@ def test_main_function(self):
931
933
ret = main ()
932
934
self .assertEqual (ret , 2 )
933
935
stderr = sys .stderr .getvalue ()
934
- self .assertEqual (stderr , "option -Z not recognized\n (for help use -h )\n " )
936
+ self .assertEqual (stderr , "option -Z not recognized\n (for help use --help )\n " )
935
937
936
938
files = {
937
939
"test.cog" : """\
Original file line number Diff line number Diff line change @@ -64,9 +64,9 @@ Cog is a command-line utility which takes arguments in standard form.
64
64
--verbosity=VERBOSITY
65
65
Control the amount of output. 2 (the default) lists all files,
66
66
1 lists only changed files, 0 lists no files.
67
- -h Print this help.
67
+ -h, --help Print this help.
68
68
69
- .. {{{end}}} (checksum: d9737a8e9fc9c2fc78a5200f2fa8440f )
69
+ .. {{{end}}} (sum: aE5SIko6oj )
70
70
71
71
In addition to running cog as a command on the command line, you can also
72
72
invoke it as a module with the Python interpreter:
You can’t perform that action at this time.
0 commit comments