Skip to content

Commit 263d823

Browse files
committed
chore: Rename actions => changes for consistency
1 parent cdcf6c3 commit 263d823

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

cli/configssh.go

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -114,17 +114,17 @@ func configSSH() *cobra.Command {
114114
}
115115

116116
// Keep track of changes we are making.
117-
var actions []string
117+
var changes []string
118118

119119
// Check for presence of old config format and
120120
// remove if present.
121121
configModified, ok := stripOldConfigBlock(configRaw)
122122
if ok {
123-
actions = append(actions, fmt.Sprintf("Remove old config block (START-CODER/END-CODER) from %s", sshConfigFileOrig))
123+
changes = append(changes, fmt.Sprintf("Remove old config block (START-CODER/END-CODER) from %s", sshConfigFileOrig))
124124
}
125125

126126
if found := bytes.Index(configModified, []byte(sshConfigIncludeStatement)); found == -1 || (found > 0 && configModified[found-1] != '\n') {
127-
actions = append(actions, fmt.Sprintf("Add 'Include coder' to %s", sshConfigFileOrig))
127+
changes = append(changes, fmt.Sprintf("Add 'Include coder' to %s", sshConfigFileOrig))
128128
// Separate Include statement from user content with an empty newline.
129129
configModified = bytes.TrimRight(configModified, "\n")
130130
sep := "\n\n"
@@ -234,19 +234,20 @@ func configSSH() *cobra.Command {
234234
modifyCoderConfig := !bytes.Equal(coderConfigRaw, buf.Bytes())
235235
if modifyCoderConfig {
236236
if len(coderConfigRaw) == 0 {
237-
actions = append(actions, fmt.Sprintf("Write auto-generated coder config file to %s", coderConfigFileOrig))
237+
changes = append(changes, fmt.Sprintf("Write auto-generated coder config file to %s", coderConfigFileOrig))
238238
} else {
239-
actions = append(actions, fmt.Sprintf("Update auto-generated coder config file in %s", coderConfigFileOrig))
239+
changes = append(changes, fmt.Sprintf("Update auto-generated coder config file in %s", coderConfigFileOrig))
240240
}
241241
}
242242

243243
if showDiff {
244-
if len(actions) > 0 {
244+
if len(changes) > 0 {
245245
// Write to stderr to avoid dirtying the diff output.
246246
_, _ = fmt.Fprint(cmd.ErrOrStderr(), "Changes:\n\n")
247-
for _, action := range actions {
248-
_, _ = fmt.Fprintf(cmd.ErrOrStderr(), "* %s\n", action)
247+
for _, change := range changes {
248+
_, _ = fmt.Fprintf(cmd.ErrOrStderr(), "* %s\n", change)
249249
}
250+
} else {
250251
}
251252

252253
for _, diffFn := range []func() ([]byte, error){
@@ -266,9 +267,9 @@ func configSSH() *cobra.Command {
266267
return nil
267268
}
268269

269-
if len(actions) > 0 {
270+
if len(changes) > 0 {
270271
_, err = cliui.Prompt(cmd, cliui.PromptOptions{
271-
Text: fmt.Sprintf("The following changes will be made to your SSH configuration (use --diff to see changes):\n\n * %s\n\n Continue?", strings.Join(actions, "\n * ")),
272+
Text: fmt.Sprintf("The following changes will be made to your SSH configuration (use --diff to see changes):\n\n * %s\n\n Continue?", strings.Join(changes, "\n * ")),
272273
IsConfirm: true,
273274
})
274275
if err != nil {

0 commit comments

Comments
 (0)