Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var InitCommand = &cobra.Command{ Use: "init", Short: "initialize a kl-config file", Long: `use this command to initialize a kl-config file`, Run: func(cmd *cobra.Command, _ []string) { aName := fn.ParseStringFlag(cmd, "account") filePath := fn.ParseKlFile(cmd) initFile, err := client.GetKlFile(filePath) if err != nil { envs, err := server.ListEnvs(fn.MakeOption("accountName", aName)) if err != nil { fn.PrintError(err) return } packages := []string{"vim", "git"} defEnv := "" if len(envs) != 0 { de, err := fzf.FindOne(envs, func(item server.Env) string { return item.Metadata.Name }, fzf.WithPrompt("Select default environment >")) if err != nil { fn.PrintError(err) return } defEnv = de.Metadata.Name } else { fn.Warn("no environment found, please create environments from dashboard") } accName, err := client.CurrentAccountName() if err != nil { fn.PrintError(err) return } initFile = &client.KLFileType{ AccountName: accName, Version: "v1", DefaultEnv: defEnv, Packages: packages, EnvVars: []client.EnvType{{Key: "SAMPLE", Value: fn.Ptr("sampleValue")}}, Mounts: client.Mounts{}, } if defEnv == "" { fn.Warn("No environment found, Please create environments from dashboard\n") } else { fn.Log("default env set to: ", defEnv) } } else { fn.Log("file already present \n") } if err = client.WriteKLFile(*initFile); err != nil { fn.PrintError(err) return } fn.Log("Initialized file ", client.GetConfigPath()) }, }
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.