Skip to content

Commit

Permalink
Clarify how args are used in Push
Browse files Browse the repository at this point in the history
  • Loading branch information
dsabeti authored and ctlong committed Aug 8, 2023
1 parent cf3eae9 commit 5d7db77
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions cf/push.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,29 +38,32 @@ var Push = func(appName string, args ...string) *gexec.Session {
}

for i := 0; i < len(args); i += 2 {
switch args[i] {
flag := args[i]
flagValue := args[i+1]

switch flag {
case "-b":
app.Buildpacks = append(app.Buildpacks, args[i+1])
app.Buildpacks = append(app.Buildpacks, flagValue)
case "-c":
app.Command = args[i+1]
app.Command = flagValue
case "-d":
app.Routes = append(app.Routes, map[string]string{"route": fmt.Sprintf("%s.%s", appName, args[i+1])})
app.Routes = append(app.Routes, map[string]string{"route": fmt.Sprintf("%s.%s", appName, flagValue)})
case "-i":
instances, err := strconv.Atoi(args[i+1])
instances, err := strconv.Atoi(flagValue)
if err != nil {
panic(err)
}
app.Instances = instances
case "-m":
app.Memory = args[i+1]
app.Memory = flagValue
case "-p":
path, err := filepath.Abs(args[i+1])
path, err := filepath.Abs(flagValue)
if err != nil {
panic(err)
}
app.Path = path
case "-s":
app.Stack = args[i+1]
app.Stack = flagValue
}
}

Expand Down

0 comments on commit 5d7db77

Please sign in to comment.