// buildPipelineInitCmd build the command for creating a new pipeline.
buildPipelineInitCmd build the command for creating a new pipeline.
// buildPipelineInitCmd build the command for creating a new pipeline .
func buildPipelineInitCmd() *cobra.Command {
	vars := initPipelineVars{}
	cmd := &cobra.Command{
		Use:   "init",
		Short: "Creates a pipeline for the services in your workspace.",
		Long:  `Creates a pipeline for the services in your workspace, using the environments associated with the application.`,
		Example: `
  Create a pipeline for the services in your workspace.
  /code $ copilot pipeline init \
  /code  --github-url https://github.com/gitHubUserName/myFrontendApp.git \
  /code  --github-access-token file://myGitHubToken \
  /code  --environments "stage,prod"`,
		RunE: runCmdE(func(cmd *cobra.Command, args []string) error {
			opts, err := newInitPipelineOpts(vars)
			if err != nil {
				return err
			}
			if err := opts.Validate(); err != nil {
				return err
			}
			if err := opts.Ask(); err != nil {
				return err
			}
			if err := opts.Execute(); err != nil {
				return err
			}
			log.Infoln()
			log.Infoln("Recommended follow-up actions:")
			for _, followup := range opts.RecommendedActions() {
				log.Infof("- %s\n", followup)
			}
			return nil
		}),
	}
	cmd.Flags().StringVarP(&vars.appName, appFlag, appFlagShort, tryReadingAppName(), appFlagDescription)
	cmd.Flags().StringVarP(&vars.githubURL, githubURLFlag, githubURLFlagShort, "", githubURLFlagDescription)
	cmd.Flags().StringVarP(&vars.githubAccessToken, githubAccessTokenFlag, githubAccessTokenFlagShort, "", githubAccessTokenFlagDescription)
	cmd.Flags().StringVarP(&vars.gitBranch, gitBranchFlag, gitBranchFlagShort, "", gitBranchFlagDescription)
	cmd.Flags().StringSliceVarP(&vars.environments, envsFlag, envsFlagShort, []string{}, pipelineEnvsFlagDescription)
	return cmd
}
func buildPipelineInitCmd ( ) * cobra . Command { vars := initPipelineVars { } cmd := & cobra . Command { Use : " " , Short : " " , Long : `Creates a pipeline for the services in your workspace, using the environments associated with the application.` , Example : `
  Create a pipeline for the services in your workspace.
  /code $ copilot pipeline init \
  /code  --github-url https://github.com/gitHubUserName/myFrontendApp.git \
  /code  --github-access-token file://myGitHubToken \
  /code  --environments "stage,prod"` , RunE : runCmdE ( func ( cmd * cobra . Command , args [ ] string ) error { opts , err := newInitPipelineOpts ( vars ) if err != nil { return err } if err := opts . Validate ( ) ; err != nil { return err } if err := opts . Ask ( ) ; err != nil { return err } if err := opts . Execute ( ) ; err != nil { return err } log . Infoln ( ) log . Infoln ( " " ) for _ , followup := range opts . RecommendedActions ( ) { log . Infof ( " \n " , followup ) } return nil } ) , } cmd . Flags ( ) . StringVarP ( & vars . appName , appFlag , appFlagShort , tryReadingAppName ( ) , appFlagDescription ) cmd . Flags ( ) . StringVarP ( & vars . githubURL , githubURLFlag , githubURLFlagShort , " " , githubURLFlagDescription ) cmd . Flags ( ) . StringVarP ( & vars . githubAccessToken , githubAccessTokenFlag , githubAccessTokenFlagShort , " " , githubAccessTokenFlagDescription ) cmd . Flags ( ) . StringVarP ( & vars . gitBranch , gitBranchFlag , gitBranchFlagShort , " " , gitBranchFlagDescription ) cmd . Flags ( ) . StringSliceVarP ( & vars . environments , envsFlag , envsFlagShort , [ ] string { } , pipelineEnvsFlagDescription ) return cmd }
buildPipelineInitCmd build the command for creating a new pipeline.
buildPipelineInitCmd build the command for creating a new pipeline .