You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: main.go
+20-5Lines changed: 20 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -6,6 +6,8 @@ import (
6
6
7
7
"github.com/alecthomas/kong"
8
8
"github.com/oalders/is/types"
9
+
"github.com/posener/complete"
10
+
"github.com/willabides/kongplete"
9
11
)
10
12
11
13
funcmain() {
@@ -19,14 +21,27 @@ func main() {
19
21
ThereThereCmd`cmd:"" help:"Check if command exists. e.g. \"is there git\""`
20
22
UserUserCmd`cmd:"" help:"Info about current user. e.g. \"is user sudoer\""`
21
23
Version kong.VersionFlag`help:"Print version to screen"`
24
+
25
+
InstallCompletions kongplete.InstallCompletions`cmd:"" help:"install shell completions. e.g. \"is install-completions\" and then run the command which is printed to your terminal"`//nolint:lll
22
26
}
23
27
24
-
ctx:=kong.Parse(&API,
25
-
kong.Vars{
26
-
"version": "0.5.0",
27
-
})
28
+
parser:=kong.Must(&API,
29
+
kong.Name("is"),
30
+
kong.Description("A shell-like example app."),
31
+
kong.UsageOnError(),
32
+
kong.Vars{"version": "0.5.0"},
33
+
)
34
+
35
+
// Run kongplete.Complete to handle completion requests
0 commit comments