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 

I can't find a related bug/issue.  

It's a natural consequence of the formatting in 

            # 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

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))
                    parts.append('%s' % option_string)


Python tracker <>
Python-bugs-list mailing list

Reply via email to