Skip to content

Commit 54dafac

Browse files
fix: addressed suggested changes
1 parent e7e7d13 commit 54dafac

4 files changed

Lines changed: 7 additions & 3 deletions

File tree

cmd/cronjobs/create.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ Examples:
133133
}
134134
path = pterm.RemoveColorFromString(path)
135135
}
136-
if method == "GET" {
136+
if !c.IsSet("method") {
137137
methods := []string{"GET", "POST", "PUT", "DELETE", "PATCH", "HEAD"}
138138
selected, selErr := pterm.DefaultInteractiveSelect.
139139
WithOptions(methods).

cmd/cronjobs/update.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,9 @@ Examples:
6262
// Decode existing settings for defaults in both TTY and non-TTY.
6363
var currentSettings api.HTTPCronjobSettings
6464
if existing.Settings != nil {
65-
_ = json.Unmarshal(*existing.Settings, &currentSettings)
65+
if err := json.Unmarshal(*existing.Settings, &currentSettings); err != nil {
66+
return fmt.Errorf("could not parse existing cron job settings: %w", err)
67+
}
6668
}
6769

6870
if !terminal.IsInteractive() {
@@ -121,10 +123,10 @@ Examples:
121123
defaultMethod = currentSettings.Method
122124
}
123125
methods := []string{"GET", "POST", "PUT", "DELETE", "PATCH", "HEAD"}
124-
_ = defaultMethod // used as visual reference; select will show all options
125126
selected, selErr := pterm.DefaultInteractiveSelect.
126127
WithOptions(methods).
127128
WithDefaultText("HTTP method").
129+
WithDefaultOption(defaultMethod).
128130
Show()
129131
if selErr != nil {
130132
return fmt.Errorf("could not read method: %w", selErr)

cmd/env/helpers.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ func resolveProjectEnv(c *cli.Context, client *api.APIClient) (string, *api.Envi
6565
return projectID, &envs[i], nil
6666
}
6767
}
68+
return "", nil, fmt.Errorf("no environment selected")
6869
}
6970

7071
// envID was known — fetch the full object so callers have UniqueName etc.

cmd/scale/scale.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ func resolveProjectAndEnv(c *cli.Context, client *api.APIClient) (string, string
9898
return projectID, envs[i].ID, nil
9999
}
100100
}
101+
return "", "", fmt.Errorf("no environment selected")
101102
}
102103

103104
return projectID, envID, nil

0 commit comments

Comments
 (0)