public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Patch] contrib/gcc-changelog: Add/improve --help
@ 2021-05-07  9:28 Tobias Burnus
  2021-05-10 10:43 ` Martin Liška
  0 siblings, 1 reply; 2+ messages in thread
From: Tobias Burnus @ 2021-05-07  9:28 UTC (permalink / raw)
  To: gcc-patches, Martin Liška

[-- Attachment #1: Type: text/plain, Size: 322 bytes --]

Hi all, hi Martin,

when running the scripts manually, I tend to get confused
which one is which.  --help helps a bit :-)

OK?

Tobias

-----------------
Mentor Graphics (Deutschland) GmbH, Arnulfstrasse 201, 80634 München Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Frank Thürauf

[-- Attachment #2: check-log.diff --]
[-- Type: text/x-patch, Size: 2282 bytes --]

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.

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..a79d2c7ba86 100755
--- a/contrib/gcc-changelog/git_email.py
+++ b/contrib/gcc-changelog/git_email.py
@@ -72,10 +72,23 @@ 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 ...]\n"
+          "\n"
+          "Check git ChangeLog format of a patch\n"
+          "\n"
+          "With zero arguments, process every patch file in the "
+          "./patches directory.\n"
+          "With one argument, process the named patch file.\n"
+          "\n"
+          "Patch files must be in 'git format-patch' format.\n\n")
+    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'):

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Patch] contrib/gcc-changelog: Add/improve --help
  2021-05-07  9:28 [Patch] contrib/gcc-changelog: Add/improve --help Tobias Burnus
@ 2021-05-10 10:43 ` Martin Liška
  0 siblings, 0 replies; 2+ messages in thread
From: Martin Liška @ 2021-05-10 10:43 UTC (permalink / raw)
  To: Tobias Burnus, gcc-patches

On 5/7/21 11:28 AM, Tobias Burnus wrote:
> Hi all, hi Martin,
> 
> when running the scripts manually, I tend to get confused
> which one is which.  --help helps a bit :-)

Good idea.

I see some "Q000 Remove bad quotes" flake8 errors:
Please use rather multiline python string:

"""
first_line
second_line
...
"""

Martin

> 
> OK?
> 
> Tobias
> 
> -----------------
> Mentor Graphics (Deutschland) GmbH, Arnulfstrasse 201, 80634 München Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Frank Thürauf



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-05-10 10:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-07  9:28 [Patch] contrib/gcc-changelog: Add/improve --help Tobias Burnus
2021-05-10 10:43 ` Martin Liška

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).