Skip to content

Commit

Permalink
cmd: info: Support only one argument
Browse files Browse the repository at this point in the history
Fixes: #196

Signed-off-by: Nirmoy Das <[email protected]>
  • Loading branch information
nirmoy committed Jun 3, 2019
1 parent 52cbf1e commit 5659e19
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 5659e19

Please sign in to comment.