github.com/kaisenlinux/docker@v0.0.0-20230510090727-ea55db55fac7/swarmkit/version/cmd.go (about)

     1  package version
     2  
     3  import (
     4  	"errors"
     5  
     6  	"github.com/spf13/cobra"
     7  )
     8  
     9  var (
    10  	// Cmd can be added to other commands to provide a version subcommand with
    11  	// the correct version of swarm.
    12  	Cmd = &cobra.Command{
    13  		Use:   "version",
    14  		Short: "Print version number of swarm",
    15  		RunE: func(cmd *cobra.Command, args []string) error {
    16  			if len(args) != 0 {
    17  				return errors.New("version command takes no arguments")
    18  			}
    19  
    20  			PrintVersion()
    21  			return nil
    22  		},
    23  	}
    24  )