Skip to content

Commit 6ab9ffe

Browse files
committed
fix: handle "remove" headless
Fixes #31 this also adds a minor improvement to usage: use the executable name not a fixed "kask"
1 parent 8196c77 commit 6ab9ffe

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

kui/kui.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,10 @@ type ExecStyle int
104104
func (component *KuiComponent) Run(context MainContext, args []string) {
105105
component.init()
106106

107+
base := path.Base(args[0])
108+
107109
if len(args) == 1 || (len(args) == 2 && (args[1] == "-h" || args[1] == "--help")) {
108-
fmt.Printf("Usage: %v\n\n", cyan("kask <command>"))
110+
fmt.Printf("Usage: %v\n\n", cyan(base + " <command>"))
109111
fmt.Printf("%v\n", yellow("Commands:"))
110112
fmt.Printf("%v\t\tList installed plugins\n", blue("list"))
111113
fmt.Printf("%v\tShow commands offered by a plugin\n", blue("commands"))
@@ -136,7 +138,6 @@ func (component *KuiComponent) Run(context MainContext, args []string) {
136138
kaskArgs = args[1:]
137139
}
138140

139-
base := path.Base(args[0])
140141
r := regexp.MustCompile("^kubectl-")
141142
var kuiCommandContext string
142143
if r.MatchString(base) {
@@ -152,7 +153,7 @@ func (component *KuiComponent) Run(context MainContext, args []string) {
152153

153154
var style ExecStyle = ExecWithStart
154155
arg := kaskArgs[0]
155-
if arg == "install" || arg == "uninstall" || arg == "list" || arg == "version" || arg == "commands" {
156+
if arg == "install" || arg == "remove" || arg == "uninstall" || arg == "list" || arg == "version" || arg == "commands" {
156157
if len(kaskArgs) == 1 || kaskArgs[1] != "--ui" {
157158
context.logger().Debug("using headless mode")
158159
cmd.Env = append(cmd.Env, "KUI_HEADLESS=true")

0 commit comments

Comments
 (0)