| 278 | self._add_item(self._format_usage, args) |
| 279 | |
| 280 | def add_argument(self, action): |
| 281 | if action.help is not SUPPRESS: |
| 282 | |
| 283 | # find all invocations |
| 284 | get_invocation = lambda x: self._decolor(self._format_action_invocation(x)) |
| 285 | invocation_lengths = [len(get_invocation(action)) + self._current_indent] |
| 286 | for subaction in self._iter_indented_subactions(action): |
| 287 | invocation_lengths.append(len(get_invocation(subaction)) + self._current_indent) |
| 288 | |
| 289 | # update the maximum item length |
| 290 | action_length = max(invocation_lengths) |
| 291 | self._action_max_length = max(self._action_max_length, |
| 292 | action_length) |
| 293 | |
| 294 | # add the item to the list |
| 295 | self._add_item(self._format_action, [action]) |
| 296 | |
| 297 | def add_arguments(self, actions): |
| 298 | for action in actions: |