remove broken "dagger create" command
Signed-off-by: Solomon Hykes <sh.github.6811@hykes.org>
This commit is contained in:
parent
00414449b7
commit
4514df1853
@ -1,35 +0,0 @@
|
|||||||
package cmd
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"dagger.cloud/go/dagger/ui"
|
|
||||||
"github.com/spf13/cobra"
|
|
||||||
)
|
|
||||||
|
|
||||||
var createCmd = &cobra.Command{
|
|
||||||
Use: "create ENV BASE",
|
|
||||||
Short: "Create an env",
|
|
||||||
Args: cobra.ExactArgs(2),
|
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
|
||||||
envname := args[0]
|
|
||||||
base := args[1]
|
|
||||||
envdir := ".dagger/env/" + envname
|
|
||||||
if info, err := os.Stat(envdir); err == nil {
|
|
||||||
if info.IsDir() {
|
|
||||||
ui.Fatalf("env already exists: %s", envname)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if err := os.MkdirAll(envdir, 0755); err != nil {
|
|
||||||
ui.Fatal(err)
|
|
||||||
}
|
|
||||||
baseCue := fmt.Sprintf("package env\nimport base \"%s\"\nbase\n", base)
|
|
||||||
err := ioutil.WriteFile(envdir+"/base.cue", []byte(baseCue), 0644)
|
|
||||||
if err != nil {
|
|
||||||
ui.Fatal(err)
|
|
||||||
}
|
|
||||||
ui.Info("created environment %q with base %q", envname, base)
|
|
||||||
},
|
|
||||||
}
|
|
@ -14,11 +14,9 @@ func init() {
|
|||||||
// --debug
|
// --debug
|
||||||
rootCmd.PersistentFlags().Bool("debug", false, "Enable debug mode")
|
rootCmd.PersistentFlags().Bool("debug", false, "Enable debug mode")
|
||||||
// --workspace
|
// --workspace
|
||||||
rootCmd.PersistentFlags().StringP("workspace", "w", "", "Select workspace")
|
|
||||||
rootCmd.AddCommand(
|
rootCmd.AddCommand(
|
||||||
// Create an env
|
|
||||||
createCmd,
|
|
||||||
computeCmd,
|
computeCmd,
|
||||||
|
// Create an env
|
||||||
// Change settings on an env
|
// Change settings on an env
|
||||||
// View or edit env serti
|
// View or edit env serti
|
||||||
// settingsCmd,
|
// settingsCmd,
|
||||||
|
Reference in New Issue
Block a user