Parses the list of ``args`` by forwarding it to :meth:`cloup.Group.parse_args`. Before doing so, if :attr:`default_if_no_args` is set to ``True`` and ``args`` is empty, this function appends to it the name of the default command specified by :attr:`default_cmd_name`.
(self, ctx: Context, args: list[str])
| 71 | self.default_cmd_name = cmd_name |
| 72 | |
| 73 | def parse_args(self, ctx: Context, args: list[str]) -> list[str]: |
| 74 | """Parses the list of ``args`` by forwarding it to |
| 75 | :meth:`cloup.Group.parse_args`. Before doing so, if |
| 76 | :attr:`default_if_no_args` is set to ``True`` and ``args`` is empty, |
| 77 | this function appends to it the name of the default command specified |
| 78 | by :attr:`default_cmd_name`. |
| 79 | |
| 80 | Parameters |
| 81 | ---------- |
| 82 | ctx |
| 83 | The Click context. |
| 84 | args |
| 85 | A list of arguments. If it's empty and :attr:`default_if_no_args` |
| 86 | is ``True``, append the name of the default command to it. |
| 87 | |
| 88 | Returns |
| 89 | ------- |
| 90 | list[str] |
| 91 | The parsed arguments. |
| 92 | """ |
| 93 | if not args and self.default_if_no_args and self.default_cmd_name: |
| 94 | args.insert(0, self.default_cmd_name) |
| 95 | parsed_args: list[str] = super().parse_args(ctx, args) |
| 96 | return parsed_args |
| 97 | |
| 98 | def get_command(self, ctx: Context, cmd_name: str) -> Command | None: |
| 99 | """Get a command function by its name, by forwarding the arguments to |