Skip to content

Commit

Permalink
fix possible missing name
Browse files Browse the repository at this point in the history
  • Loading branch information
davidsiaw committed May 15, 2020
1 parent bd667b7 commit fbdc7c3
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,23 @@ var RunCommand = cli.Command{
detach := c.Bool("detach")
envVars := c.StringSlice("envvar")
envVarMap, loadEnvVarMapErr := loadEnvVars(envName, heritageName)

if loadEnvVarMapErr != nil {
return cli.NewExitError(loadEnvVarMapErr.Error(), 1)
}

if len(envName) > 0 && len(heritageName) > 0 {
return cli.NewExitError("environment and heritage-name are exclusive", 1)
}

if len(heritageName) == 0 {
env, err := LoadEnvironment(envName)
if err != nil {
return cli.NewExitError(err.Error(), 1)
}
heritageName = env.Name
}

if len(envVars) > 0 {
varmap, err := checkEnvVars(envVars)
if err != nil {
Expand All @@ -65,6 +76,7 @@ var RunCommand = cli.Command{
envVarMap[k] = v
}
}

if len(c.Args()) == 0 {
return cli.NewExitError("Command is required", 1)
}
Expand Down

0 comments on commit fbdc7c3

Please sign in to comment.