github.com/JarrahG/buffalocli@v0.0.0-20230801092127-b85bfd5d395a/internal/cmd/new/cmd.go (about)

     1  package new
     2  
     3  import (
     4  	"fmt"
     5  	"strings"
     6  
     7  	"github.com/gobuffalo/pop/v6"
     8  	"github.com/spf13/cobra"
     9  	"github.com/spf13/viper"
    10  )
    11  
    12  func Cmd() *cobra.Command {
    13  	cmd := &cobra.Command{
    14  		Use:   "new [name]",
    15  		Short: "Creates a new Buffalo application",
    16  		RunE:  RunE,
    17  	}
    18  
    19  	cmd.Flags().Bool("api", false, "skip all front-end code and configure for an API server")
    20  	cmd.Flags().BoolP("force", "f", false, "delete and remake if the app already exists")
    21  	cmd.Flags().BoolP("dry-run", "d", false, "dry run")
    22  	cmd.Flags().BoolP("verbose", "v", false, "verbosely print out the go get commands")
    23  	cmd.Flags().Bool("skip-pop", false, "skips adding pop/soda to your app")
    24  	cmd.Flags().Bool("skip-webpack", false, "skips adding Webpack to your app")
    25  	cmd.Flags().Bool("skip-yarn", false, "use npm instead of yarn for frontend dependencies management")
    26  	cmd.Flags().Bool("skip-docker", false, "skips generating the Dockerfile")
    27  	cmd.Flags().String("db-type", "postgres", fmt.Sprintf("specify the type of database you want to use [%s]", strings.Join(pop.AvailableDialects, ", ")))
    28  	cmd.Flags().String("ci-provider", "none", "specify the type of ci file you would like buffalo to generate [none, circleci, github, gitlab-ci, travis]")
    29  	cmd.Flags().String("vcs", "git", "specify the Version control system you would like to use [none, git, bzr]")
    30  	cmd.Flags().String("module", "", "specify the root module (package) name. [defaults to 'automatic']")
    31  
    32  	viper.BindPFlags(cmd.Flags())
    33  
    34  	cfgFile := cmd.PersistentFlags().String("config", "", "config file (default is $HOME/.buffalo.yaml)")
    35  	skipConfig := cmd.Flags().Bool("skip-config", false, "skips using the config file")
    36  	cobra.OnInitialize(initConfig(skipConfig, cfgFile))
    37  
    38  	return cmd
    39  }