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

Improve how we handle flag subcommands in launcher #1698

Open
RebeccaMahany opened this issue Apr 30, 2024 · 0 comments
Open

Improve how we handle flag subcommands in launcher #1698

RebeccaMahany opened this issue Apr 30, 2024 · 0 comments

Comments

@RebeccaMahany
Copy link
Contributor

We allow for calling launcher's version subcommand with both launcher version and launcher --version. We also have another flag, --dev_help, that functions as a subcommand rather than configuration.

This means we handle subcommands in two distinct locations. For the ones that are technically flags (--version, --dev_help), we handle them in pkg/launcher/options. For the actual subcommands, we handle them in launcher main's runSubcommands.

We would like to update how this currently works to achieve several goals:

  1. Remove possibility for different behavior when calling "launcher version" versus "launcher --version." The split implementation means we have the possibility for different behavior in launcher version versus launcher --version. We should instead have one function that handles printing launcher version.
  2. Code clarity. We have a workaround to ensure that launcher main exits instead of proceeding to runLauncher when launcher --version or launcher --dev_help is called, which is to return an InfoCmdError from options parsing if those flags are present; launcher main then handles that error by returning early. This is a little bit confusing to follow.

We see two potential paths to implementation:

  1. Parse --version and --dev_help inside runSubcommands, ahead of options parsing, and handle them there; ignore them when options parsing inside pkg/launcher.
  2. Embed the booleans inside launcher.Options in pkg/launcher/options and return them, then handle them in launcher main; remove InfoCmdError.

For more context, see the original discussion here: #1693 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant