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():
print """
flawfinder [--help | -h] [--listrules] [--version]
flawfinder [--help | -h] [--version] [--listrules]
[--allowlink] [--followdotdir] [--nolink]
[--patch filename | -P filename]
[--inputs | -I] [--minlevel X | -m X]
@ -1607,9 +1607,9 @@ flawfinder [--help | -h] [--listrules] [--version]
The options cover various aspects of flawfinder as follows.
Documentation:
--help Show this usage help.
--listrules List the rules in the ruleset (rule database).
--help | -h Show this usage help.
--version Show version number.
--listrules List the rules in the ruleset (rule database).
Selecting Input Data:
--allowlink Allow symbolic links.
@ -1646,7 +1646,8 @@ flawfinder [--help | -h] [--listrules] [--version]
Only report hits that match the regular expression PATTERN.
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
by adding a colon and the column number in the line (the first
character in a line is column number 1).
@ -1760,6 +1761,8 @@ def process_options():
print version
sys.exit(0)
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()
sys.exit(0)
# 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
.B flawfinder
.\" Documentation:
.RB [ \-\-help ]
.RB [ \-\-listrules ]
.RB [ \-\-help | \-h ]
.RB [ \-\-version ]
.RB [ \-\-listrules ]
.br
.\" Selecting Input Data:
.RB [ \-\-allowlink ]
@ -320,6 +320,10 @@ by the older single-letter option convention.
.\" Leave -? undocumented... it also invokes help.
Show usage (help) information.
.TP
.BI \-\-version
Shows (just) the version number and exits.
.TP 12
.BI \-\-listrules
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
added the default warning field.
.TP
.BI \-\-version
Shows (just) the version number and exits.
.SS "Selecting Input Data"
.TP 12