github.com/landoop/schema-registry@v0.0.0-20190327143759-50a5701c1891/schema-registry-cli/cmd/versions.go (about)

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