From 5220c6879c06aaafcb6e891ff9596d7098c35065 Mon Sep 17 00:00:00 2001 From: Joel Longtine Date: Fri, 18 Feb 2022 14:52:35 -0700 Subject: [PATCH] Remove cmd new Signed-off-by: Joel Longtine --- cmd/dagger/cmd/new.go | 53 ------------------------------------------ cmd/dagger/cmd/root.go | 1 - 2 files changed, 54 deletions(-) delete mode 100644 cmd/dagger/cmd/new.go diff --git a/cmd/dagger/cmd/new.go b/cmd/dagger/cmd/new.go deleted file mode 100644 index 1e3eba77..00000000 --- a/cmd/dagger/cmd/new.go +++ /dev/null @@ -1,53 +0,0 @@ -package cmd - -import ( - "github.com/spf13/cobra" - "github.com/spf13/viper" - "go.dagger.io/dagger/cmd/dagger/cmd/common" - "go.dagger.io/dagger/cmd/dagger/logger" - "go.dagger.io/dagger/state" -) - -var newCmd = &cobra.Command{ - Use: "new ", - Short: "Create a new empty environment", - Args: cobra.ExactArgs(1), - PreRun: func(cmd *cobra.Command, args []string) { - // Fix Viper bug for duplicate flags: - // https://github.com/spf13/viper/issues/233 - if err := viper.BindPFlags(cmd.Flags()); err != nil { - panic(err) - } - }, - Run: func(cmd *cobra.Command, args []string) { - lg := logger.New() - ctx := lg.WithContext(cmd.Context()) - - project := common.CurrentProject(ctx) - - if viper.GetString("environment") != "" { - lg. - Fatal(). - Msg("cannot use option -e,--environment for this command") - } - name := args[0] - - st, err := project.Create(ctx, name, state.Plan{ - Package: viper.GetString("package"), - }, viper.GetString("platform")) - - if err != nil { - lg.Fatal().Err(err).Msg("failed to create environment") - } - - <-common.TrackProjectCommand(ctx, cmd, project, st) - }, -} - -func init() { - newCmd.Flags().StringP("package", "p", "", "references the name of the Cue package within the module to use as a plan. Default: defer to cue loader") - newCmd.Flags().String("platform", "", "platform of the running pipeline. Default: host platform") - if err := viper.BindPFlags(newCmd.Flags()); err != nil { - panic(err) - } -} diff --git a/cmd/dagger/cmd/root.go b/cmd/dagger/cmd/root.go index 8e371722..357a56c0 100644 --- a/cmd/dagger/cmd/root.go +++ b/cmd/dagger/cmd/root.go @@ -53,7 +53,6 @@ func init() { rootCmd.AddCommand( initCmd, - newCmd, listCmd, upCmd, downCmd,