| 259 | self._add_item(self._format_usage, args) |
| 260 | |
| 261 | def add_argument(self, action): |
| 262 | if action.help is not SUPPRESS: |
| 263 | |
| 264 | # find all invocations |
| 265 | get_invocation = self._format_action_invocation |
| 266 | invocations = [get_invocation(action)] |
| 267 | for subaction in self._iter_indented_subactions(action): |
| 268 | invocations.append(get_invocation(subaction)) |
| 269 | |
| 270 | # update the maximum item length |
| 271 | invocation_length = max(map(len, invocations)) |
| 272 | action_length = invocation_length + self._current_indent |
| 273 | self._action_max_length = max(self._action_max_length, |
| 274 | action_length) |
| 275 | |
| 276 | # add the item to the list |
| 277 | self._add_item(self._format_action, [action]) |
| 278 | |
| 279 | def add_arguments(self, actions): |
| 280 | for action in actions: |