Skip to content

Commit 32312b6

Browse files
committed
shell: added ActionExecutables
1 parent ab9d568 commit 32312b6

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

pkg/actions/shell/shell.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"strings"
77

88
"github.com/carapace-sh/carapace"
9+
"github.com/carapace-sh/carapace-bridge/pkg/actions/bridge"
910
"github.com/carapace-sh/carapace/pkg/style"
1011
)
1112

@@ -42,3 +43,21 @@ func ActionFunctions(hidden bool) carapace.Action {
4243
})
4344
}).Tag("shell functions")
4445
}
46+
47+
// ActionExecutables completes builtins, functions, and commands
48+
func ActionExecutables() carapace.Action {
49+
return carapace.ActionCallback(func(c carapace.Context) carapace.Action {
50+
switch len(c.Args) {
51+
case 0:
52+
return carapace.Batch(
53+
// TODO which order?
54+
ActionBuiltins(),
55+
ActionFunctions(false),
56+
carapace.ActionExecutables(),
57+
carapace.ActionFiles(),
58+
).ToA()
59+
default:
60+
return bridge.ActionCarapaceBin()
61+
}
62+
})
63+
}

0 commit comments

Comments
 (0)