Barry Warsaw pushed to branch click-cli at mailman / Mailman Core

Commits:
49cdb03f by Barry Warsaw at 2017-07-21T13:54:27-05:00
Add a comment, remove a blank line, and don't worry about coverage.

- - - - -


2 changed files:

- src/mailman/bin/mailman.py
- src/mailman/utilities/options.py


Changes:

=====================================
src/mailman/bin/mailman.py
=====================================
--- a/src/mailman/bin/mailman.py
+++ b/src/mailman/bin/mailman.py
@@ -65,6 +65,11 @@ class Subcommands(click.MultiCommand):
             return super().invoke(ctx)
 
     # https://github.com/pallets/click/issues/834
+    #
+    # Note that this only handles the case for the `mailman --help` output.
+    # To handle `mailman <subcommand> --help` we create a custom click.Command
+    # subclass and override this method there too.  See
+    # src/mailman/utilities/options.py
     def format_options(self, ctx, formatter):
         """Writes all the options into the formatter if they exist."""
         opts = []
@@ -73,7 +78,6 @@ class Subcommands(click.MultiCommand):
             if rv is not None:
                 part_a, part_b = rv
                 opts.append((part_a, part_b.replace('\n', ' ')))
-
         if opts:
             with formatter.section('Options'):
                 formatter.write_dl(opts)


=====================================
src/mailman/utilities/options.py
=====================================
--- a/src/mailman/utilities/options.py
+++ b/src/mailman/utilities/options.py
@@ -52,8 +52,14 @@ def validate_runner_spec(ctx, param, value):
 
 
 @public
-class I18nCommand(click.Command):
+class I18nCommand(click.Command):                   # pragma: nocover
     # https://github.com/pallets/click/issues/834
+    #
+    # Note that this handles the case for the `mailman <subcommand> --help`
+    # output.  To handle `mailman --help` we override the same method in the
+    # `Subcommands` subclass over in src/mailman/bin/mailman.py.  The test
+    # suite doesn't cover *this* copy of the method but who cares, since it
+    # will hopefully go away some day.
     def format_options(self, ctx, formatter):
         """Writes all the options into the formatter if they exist."""
         opts = []
@@ -62,7 +68,6 @@ class I18nCommand(click.Command):
             if rv is not None:
                 part_a, part_b = rv
                 opts.append((part_a, part_b.replace('\n', ' ')))
-
         if opts:
             with formatter.section('Options'):
                 formatter.write_dl(opts)



View it on GitLab: 
https://gitlab.com/mailman/mailman/commit/49cdb03f8007159513ea4843ca1a86165df218c6

---
View it on GitLab: 
https://gitlab.com/mailman/mailman/commit/49cdb03f8007159513ea4843ca1a86165df218c6
You're receiving this email because of your account on gitlab.com.
_______________________________________________
Mailman-checkins mailing list
Mailman-checkins@python.org
Unsubscribe: 
https://mail.python.org/mailman/options/mailman-checkins/archive%40jab.org

Reply via email to