(self, action)
| 559 | return self._join_parts(parts) |
| 560 | |
| 561 | def _format_action_invocation(self, action): |
| 562 | if not action.option_strings: |
| 563 | metavar, = self._metavar_formatter(action, action.dest)(1) |
| 564 | return metavar |
| 565 | |
| 566 | else: |
| 567 | parts = [] |
| 568 | |
| 569 | # if the Optional doesn't take a value, format is: |
| 570 | # -s, --long |
| 571 | if action.nargs == 0: |
| 572 | parts.extend(action.option_strings) |
| 573 | |
| 574 | # if the Optional takes a value, format is: |
| 575 | # -s ARGS, --long ARGS |
| 576 | else: |
| 577 | default = action.dest.upper() |
| 578 | args_string = self._format_args(action, default) |
| 579 | for option_string in action.option_strings: |
| 580 | parts.append('%s %s' % (option_string, args_string)) |
| 581 | |
| 582 | return ', '.join(parts) |
| 583 | |
| 584 | def _metavar_formatter(self, action, default_metavar): |
| 585 | if action.metavar is not None: |
no test coverage detected