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".
Option
-vis currently working only when specified directly afterg2acommand. Since usually-vparameter 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-vis 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-vverbosity parameter or some other parameter used bycmdcommand?g2a cmd -vv– is-vvva-vparameter specified 2 times, or-vparameter withvvalue?g2a cmd -xv– is-xvtwo parameters, or single-xparameter withvvalue?g2a cmd --param -v– is-va parameter or a value of--paramparameter?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:
-vis specified after command name, pass it with the rest of parameters to this command (do not intercept it).-vvand--verbose, paramenters like-xvhave to be ignored.--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".