diff options
author | Bruno Haible <bruno@clisp.org> | 2022-07-31 18:48:25 +0200 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2022-07-31 23:52:35 +0200 |
commit | 45802545353c971265bde432755647a3bbf0a973 (patch) | |
tree | 9507f25db2f2d50969586b0d846b7637d7c789d4 /gnulib-tool.py | |
parent | 07637f9716ea6ca05f0be5b1c03bd53577eea838 (diff) | |
download | gnulib-45802545353c971265bde432755647a3bbf0a973.tar.gz |
gnulib-tool.py: Improve compliance with GNU standards.
* gnulib-tool.py (main): Handle --help and --version before testing for
conflicting modes.
Diffstat (limited to 'gnulib-tool.py')
-rwxr-xr-x | gnulib-tool.py | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/gnulib-tool.py b/gnulib-tool.py index b16becb1d2..a6d4f6fa75 100755 --- a/gnulib-tool.py +++ b/gnulib-tool.py @@ -340,6 +340,17 @@ def main(): # Parse the given arguments. cmdargs = parser.parse_args() + # Handle --help and --version, ignoring all other options. + if cmdargs.help != None: + print(info.usage()) + sys.exit(0) + if cmdargs.version != None: + message = '''gnulib-tool (%s %s)%s\n%s\n%s\n\nWritten by %s.''' % \ + (info.package(), info.date(), info.version(), info.copyright(), + info.license(), info.authors()) + print(message) + sys.exit(0) + # Determine when user tries to combine modes. args = [ cmdargs.mode_list, @@ -374,15 +385,6 @@ def main(): sys.exit(1) # Determine selected mode. - if cmdargs.help != None: - print(info.usage()) - sys.exit(0) - if cmdargs.version != None: - message = '''gnulib-tool (%s %s)%s\n%s\n%s\n\nWritten by %s.''' % \ - (info.package(), info.date(), info.version(), info.copyright(), - info.license(), info.authors()) - print(message) - sys.exit(0) if cmdargs.mode_list != None: mode = 'list' if cmdargs.mode_import != None: |