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