1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
package cmd
import (
"fmt"
"github.com/spf13/cobra"
)
var versionsCmd = &cobra.Command{
Use: "versions",
Short: "lists all available versions",
Long: ``,
RunE: func(cmd *cobra.Command, args []string) error {
if len(args) != 1 {
return fmt.Errorf("expected 1 argument")
}
client := assertClient()
vers, err := client.Versions(args[0])
if err != nil {
return err
}
fmt.Printf("%v\n", vers)
return nil
},
}
func init() {
RootCmd.AddCommand(versionsCmd)
}
|