Skip to content

Commit e8ebe57

Browse files
committed
refactor: ♻️ rename delete command to remove
1 parent 6d77536 commit e8ebe57

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

cmd/codecommit/branch/branch.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"github.com/spf13/pflag"
66
"k8s.io/kubectl/pkg/util/templates"
77

8-
"github.com/JamesChung/cprl/cmd/codecommit/branch/del"
8+
"github.com/JamesChung/cprl/cmd/codecommit/branch/remove"
99
"github.com/JamesChung/cprl/pkg/util"
1010
)
1111

@@ -23,7 +23,7 @@ func setPersistentFlags(flags *pflag.FlagSet) {
2323

2424
func branchCommands() []*cobra.Command {
2525
return []*cobra.Command{
26-
del.NewCmd(),
26+
remove.NewCmd(),
2727
}
2828
}
2929

cmd/codecommit/branch/del/delete.go renamed to cmd/codecommit/branch/remove/remove.go

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package del
1+
package remove
22

33
import (
44
"fmt"
@@ -15,13 +15,13 @@ import (
1515
)
1616

1717
var (
18-
shortMessage = "Delete branches"
18+
shortMessage = "Remove branches"
1919

2020
longMessage = templates.LongDesc(`
21-
Delete a branch`)
21+
Removes branches`)
2222

2323
example = templates.Examples(`
24-
cprl codecommit branch delete
24+
cprl codecommit branch remove
2525
`)
2626
)
2727

@@ -35,8 +35,8 @@ func setPersistentFlags(flags *pflag.FlagSet) {
3535

3636
func NewCmd() *cobra.Command {
3737
cmd := &cobra.Command{
38-
Use: "delete",
39-
Aliases: []string{"d", "del"},
38+
Use: "remove",
39+
Aliases: []string{"r", "rem"},
4040
Short: shortMessage,
4141
Long: longMessage,
4242
Example: example,
@@ -73,28 +73,28 @@ func runCmd(cmd *cobra.Command, args []string) {
7373
})
7474
util.ExitOnErr(err)
7575

76-
// Prompt for branches to delete
76+
// Prompt for branches to remove
7777
branchSelections, err := pterm.DefaultInteractiveMultiselect.
78-
WithOptions(branches).Show("Select branches to delete")
78+
WithOptions(branches).Show("Select branches to remove")
7979
util.ExitOnErr(err)
8080

81-
// Delete branches
81+
// Remove branches
8282
var results []util.Result[string]
83-
util.Spinner("Deleting...", func() {
83+
util.Spinner("Removing...", func() {
8484
results = util.DeleteBranches(ccClient, repo, branchSelections)
8585
})
8686

8787
failCount := 0
8888
for _, r := range results {
8989
if r.Err != nil {
90-
pterm.Error.Printf("Failed to delete branch [%s]\n", r.Result)
90+
pterm.Error.Printf("Failed to remove branch [%s]\n", r.Result)
9191
failCount++
9292
continue
9393
}
94-
pterm.Success.Printf("Successfully deleted branch [%s]\n", r.Result)
94+
pterm.Success.Printf("Successfully removed branch [%s]\n", r.Result)
9595
}
9696

9797
if failCount > 0 {
98-
util.ExitOnErr(fmt.Errorf("Failed to delete %d branches\n", failCount))
98+
util.ExitOnErr(fmt.Errorf("Failed to remove %d branches\n", failCount))
9999
}
100100
}

0 commit comments

Comments
 (0)