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