Documentation ¶
Index ¶
- Variables
- func GetStatus(err error, opts variant.Opts) int
- func HandleError(err error, opts variant.Opts) (string, int)
- func HandleErrorAndExit(err error, opts variant.Opts)
- func LogAndExit(opts variant.Opts, msg string, status int)
- func MustRun()
- func Run(taskDef *variant.TaskDef, opts variant.Opts) (map[string]string, error)
- func RunE() (variant.Opts, error)
- func VersionCmd(log *logrus.Logger) *cobra.Command
- func YAML(yaml string)
- type Command
Constants ¶
This section is empty.
Variables ¶
View Source
var BuildCmd = &cobra.Command{ Use: "build VARIANTFILE", Short: "Create a single executable from the Variantfile", Long: `Create a single executable from the Variantfile`, RunE: func(cmd *cobra.Command, args []string) error { taskDef, err := load.File(args[0]) if err != nil { return err } fmt.Fprintf(os.Stdout, "%#v", taskDef) return nil }, }
View Source
var EnvCmd = &cobra.Command{ Use: "env", Short: "Print currently selected environment", Long: `Print currently selected environment. The environment can be via the command "var env set" or "var env switch". Example: var env switch dev var env #=> Prints "dev" `, Run: func(cmd *cobra.Command, args []string) { env, err := env.Get() if err != nil { panic(err) } fmt.Println(env) }, }
View Source
var InitCmd = &cobra.Command{ Use: "init NAME", Short: "Create a Variant command", Long: `Create a Variant command with the specified NAME Example: cat <<EOF | variant init mycmd tasks: script: | echo Hello Variant! EOF ./mycmd `, Run: func(cmd *cobra.Command, args []string) { bytes, err := ioutil.ReadAll(os.Stdin) if err != nil { panic(err) } header := "#!/usr/bin/env variant\n\n" bytes = append([]byte(header), bytes...) if err := ioutil.WriteFile(args[0], bytes, 0755); err != nil { panic(err) } }, }
View Source
var UtilsCmd = &cobra.Command{ Use: "utils NAME", Short: "Create a Variant command", Long: `Create a Variant command with the specified NAME Example: cat <<EOF | variant init mycmd tasks: script: | echo Hello Variant! EOF ./mycmd `, Run: func(cmd *cobra.Command, args []string) { bytes, err := ioutil.ReadAll(os.Stdin) if err != nil { panic(err) } header := "#!/usr/bin/env variant\n\n" bytes = append([]byte(header), bytes...) if err := ioutil.WriteFile(args[0], bytes, 0755); err != nil { panic(err) } }, }
Functions ¶
func HandleErrorAndExit ¶ added in v0.36.4
Types ¶
Click to show internal directories.
Click to hide internal directories.