anaconda / anaconda-client

Anaconda Server Client
https://anaconda.org
BSD 3-Clause "New" or "Revised" License
146 stars 240 forks source link

fix: Manually handle `sys.argv` to allow proper delegation to `binstar_main` #721

Closed mattkram closed 2 months ago

mattkram commented 2 months ago

This PR fixes a bug related to the passing of top-level CLI options into binstar_main.

Specifically, when running commands like:

Since we would like both of those commands to be handled by binstar_main, while allowing the top-level entrypoint to be handled by anaconda-cli-base, we need some special handling of the top-level options (--token, --site, etc.).

For now, we just simply pass through sys.argv (with the optional org subcommand removed). This allows us to have completely backwards-compatible behavior. When we replace subcommands with click/typer-based alternatives, we can pass through these top-level options via the context (ctx) object, but for now this solution should be sufficient.