github.com/azunymous/cdx@v0.0.0-20201122180449-fbb46cc4d252/commands/tag.go (about)

     1  package commands
     2  
     3  import (
     4  	"github.com/azunymous/cdx/commands/options"
     5  	"github.com/sirupsen/logrus"
     6  	"github.com/spf13/cobra"
     7  )
     8  
     9  // addTag adds the primary tag command to a top level command.
    10  func addTag(topLevel *cobra.Command) {
    11  	appOpts := &options.App{}
    12  
    13  	tagCmd := &cobra.Command{
    14  		Use:   "tag",
    15  		Short: "Tag git repositories",
    16  		Long: `The tag command allows you to semantically version and promote
    17  your git repository
    18  `,
    19  		Run: func(cmd *cobra.Command, args []string) {
    20  			err := tag(cmd, args, appOpts)
    21  			if err != nil {
    22  				logrus.Fatal(err)
    23  			}
    24  		},
    25  		Args: cobra.NoArgs,
    26  	}
    27  
    28  	options.AddNameArg(tagCmd, appOpts)
    29  	topLevel.AddCommand(tagCmd)
    30  
    31  	addRelease(tagCmd, appOpts)
    32  	addPromote(tagCmd, appOpts)
    33  	addLatest(tagCmd, appOpts)
    34  }
    35  
    36  func tag(cmd *cobra.Command, args []string, appOpts *options.App) error {
    37  	return cmd.Help()
    38  }