mirror of
https://github.com/wavetermdev/inshellisense.git
synced 2026-08-05 13:43:30 -07:00
fix: nested non commands trigger stack overflow
Signed-off-by: Chapman Pendery <cpendery@vt.edu>
This commit is contained in:
+2
@@ -0,0 +1,2 @@
|
||||
([]string) {
|
||||
}
|
||||
@@ -189,6 +189,10 @@ func handleSubcommand(tokens []commandToken, spec model.Subcommand, persistentOp
|
||||
return handleSubcommand(tokens[1:], *subcommand, persistentOptions, false, false, getPersistentTokens(acceptedTokens))
|
||||
}
|
||||
|
||||
if len(spec.Args) == 0 { // not subcommand or option & no args exist
|
||||
return
|
||||
}
|
||||
|
||||
return handleArg(tokens, spec.Args, spec, persistentOptions, acceptedTokens, false, false)
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ func TestLoadSuggestions(t *testing.T) {
|
||||
{Name: "providedArgDescription", Cmd: "act completion bash -a "},
|
||||
{Name: "completedOptionWithArg", Cmd: "act completion bash -a 'actor' "},
|
||||
{Name: "command", Cmd: "sudo git sta", Skip: true}, // TODO: fix skipped test
|
||||
{Name: "nestedNonCommands", Cmd: "az az ", Skip: true}, // TODO: fix skipped test
|
||||
{Name: "nestedNonCommands", Cmd: "az az "},
|
||||
}
|
||||
for _, test := range tests {
|
||||
test := test
|
||||
|
||||
Reference in New Issue
Block a user