Skip to content

Commit

Permalink
cmd: info: Support only one argument (kubernetes-sigs#197)
Browse files Browse the repository at this point in the history
  • Loading branch information
nirmoy authored and k8s-ci-robot committed Jun 4, 2019
1 parent 5da7e35 commit c3c3e6c
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions cmd/krew/cmd/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,17 @@ available version, platform availability and the caveats.
Example:
kubectl krew info PLUGIN`,
RunE: func(cmd *cobra.Command, args []string) error {
for _, arg := range args {
plugin, err := indexscanner.LoadPluginFileFromFS(paths.IndexPath(), arg)
if os.IsNotExist(err) {
return errors.Errorf("plugin %q not found", arg)
} else if err != nil {
return errors.Wrap(err, "failed to load plugin manifest")
}
printPluginInfo(os.Stdout, plugin)
plugin, err := indexscanner.LoadPluginFileFromFS(paths.IndexPath(), args[0])
if os.IsNotExist(err) {
return errors.Errorf("plugin %q not found", args[0])
} else if err != nil {
return errors.Wrap(err, "failed to load plugin manifest")
}
printPluginInfo(os.Stdout, plugin)
return nil
},
PreRunE: checkIndex,
Args: cobra.MinimumNArgs(1),
Args: cobra.ExactArgs(1),
}

func printPluginInfo(out io.Writer, plugin index.Plugin) {
Expand Down

0 comments on commit c3c3e6c

Please sign in to comment.