Reorder help information, help and version are really common requests

This commit is contained in:
David A. Wheeler 2014-08-02 21:46:29 -04:00
parent 24b7da535b
commit 4c36be0094
2 changed files with 13 additions and 10 deletions

View File

@ -1593,7 +1593,7 @@ def process_file_args(files, patch_infos):
def usage(): def usage():
print """ print """
flawfinder [--help | -h] [--listrules] [--version] flawfinder [--help | -h] [--version] [--listrules]
[--allowlink] [--followdotdir] [--nolink] [--allowlink] [--followdotdir] [--nolink]
[--patch filename | -P filename] [--patch filename | -P filename]
[--inputs | -I] [--minlevel X | -m X] [--inputs | -I] [--minlevel X | -m X]
@ -1607,9 +1607,9 @@ flawfinder [--help | -h] [--listrules] [--version]
The options cover various aspects of flawfinder as follows. The options cover various aspects of flawfinder as follows.
Documentation: Documentation:
--help Show this usage help. --help | -h Show this usage help.
--listrules List the rules in the ruleset (rule database).
--version Show version number. --version Show version number.
--listrules List the rules in the ruleset (rule database).
Selecting Input Data: Selecting Input Data:
--allowlink Allow symbolic links. --allowlink Allow symbolic links.
@ -1646,7 +1646,8 @@ flawfinder [--help | -h] [--listrules] [--version]
Only report hits that match the regular expression PATTERN. Only report hits that match the regular expression PATTERN.
Selecting Output Format: Selecting Output Format:
--columns Show the column number (as well as the file name and --columns | -C
Show the column number (as well as the file name and
line number) of each hit; this is shown after the line number line number) of each hit; this is shown after the line number
by adding a colon and the column number in the line (the first by adding a colon and the column number in the line (the first
character in a line is column number 1). character in a line is column number 1).
@ -1760,6 +1761,8 @@ def process_options():
print version print version
sys.exit(0) sys.exit(0)
elif opt in [ '-h', '-?', '--help' ]: elif opt in [ '-h', '-?', '--help' ]:
# We accept "-?" but do not document it. On Unix-like systems the
# question mark in "-?" should be escaped, and many forget that.
usage() usage()
sys.exit(0) sys.exit(0)
# For DOS/Windows, expand filenames; for Unix, DON'T expand them # For DOS/Windows, expand filenames; for Unix, DON'T expand them

View File

@ -25,9 +25,9 @@ flawfinder \- lexically find potential security flaws ("hits") in source code
.SH SYNOPSIS .SH SYNOPSIS
.B flawfinder .B flawfinder
.\" Documentation: .\" Documentation:
.RB [ \-\-help ] .RB [ \-\-help | \-h ]
.RB [ \-\-listrules ]
.RB [ \-\-version ] .RB [ \-\-version ]
.RB [ \-\-listrules ]
.br .br
.\" Selecting Input Data: .\" Selecting Input Data:
.RB [ \-\-allowlink ] .RB [ \-\-allowlink ]
@ -320,6 +320,10 @@ by the older single-letter option convention.
.\" Leave -? undocumented... it also invokes help. .\" Leave -? undocumented... it also invokes help.
Show usage (help) information. Show usage (help) information.
.TP
.BI \-\-version
Shows (just) the version number and exits.
.TP 12 .TP 12
.BI \-\-listrules .BI \-\-listrules
List the terms (tokens) List the terms (tokens)
@ -334,10 +338,6 @@ Combine with \-D if you do not want the usual header.
Flawfinder version 1.29 changed the separator from spaces to tabs, and Flawfinder version 1.29 changed the separator from spaces to tabs, and
added the default warning field. added the default warning field.
.TP
.BI \-\-version
Shows (just) the version number and exits.
.SS "Selecting Input Data" .SS "Selecting Input Data"
.TP 12 .TP 12