Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(cli): Fix erroneous subcommand as a run tentative #4728

Merged
merged 1 commit into from
May 21, 2024

Conversation

xdoardo
Copy link
Contributor

@xdoardo xdoardo commented May 21, 2024

This small PR introduces a mechanism that, in case the CLI parser fails to parse the command correctly, tries to dynamically match the first argument given to the CLI against the names of available subcommands before trying to interpret it as the name of a package to run.

For example, this helps avoiding situations such as

$ wasmer deploy my-app
<tries to *run* the package `deploy`>

With this patch, it will instead result in:

$ wasmer deploy test 
error: unexpected argument 'test' found

Usage: wasmer deploy [OPTIONS]

For more information, try '--help'.

I don't think that the overhead of this patch will be unbearable, but another, lighter possibility to avoid this problem is to make it so that the wasmer_config::package::PackageSource struct does not allow non-namespaced named packages, if viable (e.g. namespace/name@version is ok, namespace/name is ok, name@version is not)

@xdoardo xdoardo requested a review from syrusakbary as a code owner May 21, 2024 14:19
@xdoardo xdoardo enabled auto-merge May 21, 2024 15:03
@xdoardo xdoardo merged commit 3dee029 into main May 21, 2024
61 checks passed
@xdoardo xdoardo deleted the fix-erroneous-subcommand-run branch May 21, 2024 16:31
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.

2 participants