paul j3 added the comment:

Sorry, I missed that.  For some reason I looking something bigger.

That's coming from the `metavar=""'.

If I specify `metavar="xxx" that help line will have

    -p xxx, --projectid xxx

Replace the 'xxx` with '', and you still have space between '-p' and ','.

Now that I see it, it looks familiar.  I noted it in passing in StackOverflow 
answer, http://stackoverflow.com/a/40497623/901925

I can't find a related bug/issue.  

It's a natural consequence of the formatting in 
HelpFormatter._format_action_invocation

            # if the Optional takes a value, format is:
            #    -s ARGS, --long ARGS
            parts.append('%s %s' % (option_string, args_string))

There's no special handling for the case where ARGS is blank.

That formatter method could be customized as suggested in 

http://stackoverflow.com/a/23941599/901925

Often people want a more compact invocation like:

  -s, --long ARG    help

Usage gets that space between option_string and args_string, but it gets 
striped out later.

So the fix (not tested) would something like:

      def _format_action_invocation(self, action):
           ....
           for option_string in action.option_strings:
               if len(args_string)>0:
                    parts.append('%s %s' % (option_string, args_string))
               else:
                    parts.append('%s' % option_string)
           ....

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue29626>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to