Skip to content

Commit

Permalink
Support shortcut (del) of the delete action
Browse files Browse the repository at this point in the history
  • Loading branch information
icy committed Sep 23, 2024
1 parent 1f97b5c commit a2f0c79
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func args2cmd(args []string) (string, []string) {
}

for _, arg := range args {
if arg == "delete" {
if arg == "delete" || arg == "del" {
if os.Getenv("DELETE") == "true" {
break
}
Expand Down
15 changes: 15 additions & 0 deletions tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,17 @@ _fail_to_delete() {
)
}

_fail_to_del() {
(
touch ~/.config/gk8s/foobar
# shellcheck disable=SC2030
# shellcheck disable=SC2031
PATH="$(pwd -P)":$PATH
export PATH
_gk8s :foobar del pods
)
}

_ok_to_delete() {
(
touch ~/.config/gk8s/foobar
Expand Down Expand Up @@ -214,6 +225,10 @@ default() {
"File .delete does.* exist" \
"Fail to delete because .delete file not found."

_test _fail_to_del \
"File .delete does.* exist" \
"Fail to del(ete) because .delete file not found."

_test _ok_to_delete \
"File .delete was removed." \
"Flag file will be removed first."
Expand Down

0 comments on commit a2f0c79

Please sign in to comment.