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

Parse -v parameter on any position #5

Open
qzb opened this issue Oct 30, 2020 · 0 comments
Open

Parse -v parameter on any position #5

qzb opened this issue Oct 30, 2020 · 0 comments
Labels
enhancement New feature or request
Milestone

Comments

@qzb
Copy link
Contributor

qzb commented Oct 30, 2020

Option -v is currently working only when specified directly after g2a command. Since usually -v parameter is added when users try to run command again in order to debug why it failed, it's really convieniet to add it on the very end of the line. The problem is, when -v is specified after name of subcommand, we cannot reliably parse it and remove it from parameters passed down to sub-command. To illustrate the issue, take a look for these examples:

  • g2a cmd -v – is -v verbosity parameter or some other parameter used by cmd command?
  • g2a cmd -vv – is -vvv a -v parameter specified 2 times, or -v parameter with v value?
  • g2a cmd -xv – is -xv two parameters, or single -x parameter with v value?
  • g2a cmd --param -v – is -v a parameter or a value of --param parameter?

It's impossible to mitigate all these issues without knowing exact structure of the sub-command's parameters, but we can try to reduce their impact by applying following rules:

  • If -v is specified after command name, pass it with the rest of parameters to this command (do not intercept it).
  • Parse only standalone occurences like -vv and --verbose, paramenters like -xv have to be ignored.
  • Behaviour of other global parameters (like --log-level) shouldn't be changed (they should be parsed only if specified before command name).

Since it will cause errors on commands wich doesn't accept unknown parameters, this change must apply only to commands using API newer than "g2a-cli/v1beta1".

@qzb qzb added the enhancement New feature or request label Oct 30, 2020
@qzb qzb added this to the v3 milestone Oct 30, 2020
@crazybarber crazybarber self-assigned this Dec 22, 2021
@crazybarber crazybarber removed their assignment May 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants