Remove cmd new
Signed-off-by: Joel Longtine <joel@dagger.io>
This commit is contained in:
parent
1fe005557a
commit
5220c6879c
@ -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 <NAME>",
|
|
||||||
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)
|
|
||||||
}
|
|
||||||
}
|
|
@ -53,7 +53,6 @@ func init() {
|
|||||||
|
|
||||||
rootCmd.AddCommand(
|
rootCmd.AddCommand(
|
||||||
initCmd,
|
initCmd,
|
||||||
newCmd,
|
|
||||||
listCmd,
|
listCmd,
|
||||||
upCmd,
|
upCmd,
|
||||||
downCmd,
|
downCmd,
|
||||||
|
Reference in New Issue
Block a user