github.com/simonferquel/app@v0.6.1-0.20181012141724-68b7cccf26ac/cmd/docker-app/init.go (about)

     1  package main
     2  
     3  import (
     4  	"github.com/docker/app/internal/packager"
     5  	"github.com/docker/cli/cli"
     6  	"github.com/spf13/cobra"
     7  )
     8  
     9  var (
    10  	initComposeFile string
    11  	initDescription string
    12  	initMaintainers []string
    13  	initSingleFile  bool
    14  )
    15  
    16  // initCmd represents the init command
    17  func initCmd() *cobra.Command {
    18  	cmd := &cobra.Command{
    19  		Use:   "init <app-name> [-c <compose-file>] [-d <description>] [-m name:email ...]",
    20  		Short: "Start building a Docker application",
    21  		Long:  `Start building a Docker application. Will automatically detect a docker-compose.yml file in the current directory.`,
    22  		Args:  cli.ExactArgs(1),
    23  		RunE: func(cmd *cobra.Command, args []string) error {
    24  			return packager.Init(args[0], initComposeFile, initDescription, initMaintainers, initSingleFile)
    25  		},
    26  	}
    27  	cmd.Flags().StringVarP(&initComposeFile, "compose-file", "c", "", "Initial Compose file (optional)")
    28  	cmd.Flags().StringVarP(&initDescription, "description", "d", "", "Initial description (optional)")
    29  	cmd.Flags().StringArrayVarP(&initMaintainers, "maintainer", "m", []string{}, "Maintainer (name:email) (optional)")
    30  	cmd.Flags().BoolVarP(&initSingleFile, "single-file", "s", false, "Create a single-file application")
    31  	return cmd
    32  }