Skip to content

How to accept additional arguments #582

@FredrikNoren

Description

@FredrikNoren

Hi,

I can't seem to find how to handle this; I'd like my subcommand to just accept all additional arguments into a List[str], something like:

class StartJobCommand(BaseSettings):
    module: str
    args: List[str]

    def cli_cmd(self) -> None:
        print("Starting job", self.module, self.args)

class ClusterCli(BaseSettings):
    start_job: CliSubCommand[StartJobCommand]
    def cli_cmd(self) -> None:
        CliApp.run_subcommand(self)

if __name__ == "__main__":
    CliApp.run(ClusterCli)

which I'd like to run with python -m cluster start_job testy --any extra --arguments here

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions