From 8300c34660b1711fad1cbdafd9aa470d19f5a47d Mon Sep 17 00:00:00 2001 From: Tobias Burnus Date: Mon, 10 May 2021 15:13:37 +0200 Subject: contrib/gcc-changelog: Add/improve --help contrib/ChangeLog: * gcc-changelog/git_check_commit.py (__Main__): State in --help the default value for 'revisions'. * gcc-changelog/git_email.py (show_help): Add. (__main__): Handle -h and --help. --- contrib/gcc-changelog/git_check_commit.py | 3 ++- contrib/gcc-changelog/git_email.py | 21 ++++++++++++++++++--- 2 files changed, 20 insertions(+), 4 deletions(-) (limited to 'contrib/gcc-changelog') diff --git a/contrib/gcc-changelog/git_check_commit.py b/contrib/gcc-changelog/git_check_commit.py index 935425ef813..246e9735c1d 100755 --- a/contrib/gcc-changelog/git_check_commit.py +++ b/contrib/gcc-changelog/git_check_commit.py @@ -23,7 +23,8 @@ from git_repository import parse_git_revisions parser = argparse.ArgumentParser(description='Check git ChangeLog format ' 'of a commit') parser.add_argument('revisions', default='HEAD', nargs='?', - help='Git revisions (e.g. hash~5..hash or just hash)') + help='Git revisions (e.g. hash~5..hash or just hash) - ' + 'if not specified: HEAD') parser.add_argument('-g', '--git-path', default='.', help='Path to git repository') parser.add_argument('-p', '--print-changelog', action='store_true', diff --git a/contrib/gcc-changelog/git_email.py b/contrib/gcc-changelog/git_email.py index b0547b363aa..7ebf4c4e6ec 100755 --- a/contrib/gcc-changelog/git_email.py +++ b/contrib/gcc-changelog/git_email.py @@ -72,10 +72,25 @@ class GitEmail(GitCommit): commit_to_info_hook=lambda x: None) -# With zero arguments, process every patch file in the ./patches directory. -# With one argument, process the named patch file. -# Patch files must be in 'git format-patch' format. +def show_help(): + print(""" +usage: git_email.py [--help] [patch file ...] + +Check git ChangeLog format of a patch + +With zero arguments, process every patch file in the +./patches directory. +With one argument, process the named patch file. + +Patch files must be in 'git format-patch' format. +""") + sys.exit(0) + + if __name__ == '__main__': + if len(sys.argv) == 2 and (sys.argv[1] == '-h' or sys.argv[1] == '--help'): + show_help() + if len(sys.argv) == 1: allfiles = [] for root, _dirs, files in os.walk('patches'): -- cgit v1.2.3