Skip to content

[CLI] Handle unrecognized arguments#3076

Merged
un-def merged 1 commit intomasterfrom
issue_3073_cli_dont_ignore_unknown_args
Sep 9, 2025
Merged

[CLI] Handle unrecognized arguments#3076
un-def merged 1 commit intomasterfrom
issue_3073_cli_dont_ignore_unknown_args

Conversation

@un-def
Copy link
Copy Markdown
Collaborator

@un-def un-def commented Sep 4, 2025

  • All commands now reject unrecognized arguments

  • Undocumented ${{ run.args }} for tasks and services is still supported but requires -- pseudo-argument:

    If you have positional arguments that must begin with -
    and don’t look like negative numbers, you can insert
    the pseudo-argument '--' which tells parse_args()
    that everything after that is a positional argument

    dstack apply --reuse -- --some=arg --some-option
                         ^^
    

Fixes: #3073


@peterschmidt85 not sure if we want to drop ${{ run.args }} altogether or document it as a feature.

asciicast

* All commands now reject unrecognized arguments
* Undocumented `${{ run.args }}` for tasks and services is still
  supported but requires `--` pseudo-argument:

  > If you have positional arguments that must begin with `-`
  > and don’t look like negative numbers, you can insert
  > the pseudo-argument `'--'` which tells `parse_args()`
  > that everything after that is a positional argument

  ```
  dstack apply --reuse -- --some=arg --some-option
                       ^^
  ```

Fixes: #3073
@peterschmidt85
Copy link
Copy Markdown
Contributor

@un-def
Was just testing dstack init and got an indirectly related question.

dstack init --help
Usage: dstack init [-h] [--project PROJECT] [-P REPO] [-t OAUTH_TOKEN] [--git-identity SSH_PRIVATE_KEY]

Options:
  -h, --help            Show this help message and exit
  --project PROJECT     The name of the project
  -P, --repo REPO       The repo to initialize. Can be a local path or a Git repo URL. Defaults to the current working directory.
  -t, --token OAUTH_TOKEN
                        An authentication token to access a private Git repo
  --git-identity SSH_PRIVATE_KEY
                        The private SSH key path to access a private Git repo

The command for some reason doesn't show --ssh-identity and --remove but respects and supports them. I wonder they aren't in the help message.

@un-def un-def merged commit a6b25bb into master Sep 9, 2025
28 checks passed
@un-def un-def deleted the issue_3073_cli_dont_ignore_unknown_args branch September 9, 2025 07:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: CLI swallows unknown arguments

3 participants