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) `, RunE: func(cmd *cobra.Command, args []string) error { 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 { return errors.New("No command specified") } config, err := config.RestoreConfig() if err != nil { return errors.Wrap(err, "Failed to restore manifest") } mergedEnvVars, err := loadAndMergeEnvFiles(envName, config) if err != nil { return err } if err := runCommandWithEnv(childCommand, mergedEnvVars); err != nil { return errors.Wrap(err, "Command execution failed") } return nil }, }
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.