Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var RunCmd = &cobra.Command{ Use: "run [environment] -- [command]", Short: "Run your app with the specified environment", Long: ` The run command executes your application with the specified environment variables. Usage: hyphen env run [environment] -- [command] Examples: hyphen env run production -- go run main.go hyphen env run staging -- node server.js hyphen env run -- go run main.go (uses default environment) `, Run: func(cmd *cobra.Command, args []string) { printer = cprint.NewCPrinter(flags.VerboseFlag) var envName string var childCommand []string separatorIndex := cmd.ArgsLenAtDash() if separatorIndex == -1 || separatorIndex == 0 { envName = "default" childCommand = args } else { envName = args[0] childCommand = args[separatorIndex:] } if len(childCommand) == 0 { printer.Error(cmd, errors.New("No command specified")) return } manifest, err := manifest.Restore() if err != nil { printer.Error(cmd, errors.Wrap(err, "Failed to restore manifest")) return } mergedEnvVars, err := loadAndMergeEnvFiles(envName, manifest) if err != nil { printer.Error(cmd, err) return } if err := runCommandWithEnv(childCommand, mergedEnvVars); err != nil { printer.Error(cmd, errors.Wrap(err, "Command execution failed")) return } }, }
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.