fix: add mutual exclusion for OrgId and OrgName params (#377)

Display an error when the OrgName and OrgId flags are both passed in. Only one or the other is allowed.

closes https://github.com/influxdata/influx-cli/issues/371
This commit is contained in:
Andrew Lee
2022-05-13 18:50:22 -06:00
committed by GitHub
parent 35279515e9
commit 50de408a0a
18 changed files with 110 additions and 0 deletions

View File

@ -108,6 +108,9 @@ func newTemplateCmd() cli.Command {
),
Before: middleware.WithBeforeFns(withCli(), withApi(true), middleware.NoArgs),
Action: func(ctx *cli.Context) error {
if err := checkOrgFlags(&params.orgParams); err != nil {
return err
}
parsedParams := template.SummarizeParams{
OrgParams: params.orgParams,
RenderTableColors: !params.noColor,
@ -138,6 +141,9 @@ func newTemplateValidateCmd() cli.Command {
Flags: append(commonFlagsNoPrint(), templateFlags(&params)...),
Before: middleware.WithBeforeFns(withCli(), withApi(true), middleware.NoArgs),
Action: func(ctx *cli.Context) error {
if err := checkOrgFlags(&params.orgParams); err != nil {
return err
}
parsedParams := template.ValidateParams{
OrgParams: params.orgParams,
}