forked from istio/istio
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make --remote and --s as default for istioctl version command (istio#…
…13389) * make remote and short as default * fix lint
- Loading branch information
1 parent
137e1b3
commit 9c9a15f
Showing
3 changed files
with
32 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
|
||
"github.com/spf13/cobra" | ||
"github.com/spf13/pflag" | ||
|
||
istioVersion "istio.io/istio/pkg/version" | ||
) | ||
|
||
func newVersionCommand() *cobra.Command { | ||
versionCmd := istioVersion.CobraCommandWithOptions(istioVersion.CobraOptions{GetRemoteVersion: getRemoteInfo}) | ||
versionCmd.Flags().VisitAll(func(flag *pflag.Flag) { | ||
if flag.Name == "short" { | ||
err := flag.Value.Set("true") | ||
if err != nil { | ||
fmt.Fprint(os.Stdout, fmt.Sprintf("set flag %q as true failed due to error %v", flag.Name, err)) | ||
} | ||
} | ||
if flag.Name == "remote" { | ||
err := flag.Value.Set("true") | ||
if err != nil { | ||
fmt.Fprint(os.Stdout, fmt.Sprintf("set flag %q as true failed due to error %v", flag.Name, err)) | ||
} | ||
} | ||
}) | ||
return versionCmd | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters