Skip to content

Commit 8375592

Browse files
committed
tldr: support variants
1 parent 49418e2 commit 8375592

File tree

7 files changed

+29
-9
lines changed

7 files changed

+29
-9
lines changed

cmd/carapace-generate/gen.go

+13
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,19 @@ func readCompleters() ([]string, map[string]string) {
133133
description := readDescription(root, file.Name())
134134
names = append(names, name)
135135
descriptions[name] = description
136+
137+
if files, err := os.ReadDir(root + "/completers/" + file.Name()); err == nil {
138+
for _, file := range files {
139+
if file.IsDir() && file.Name() != "cmd" { // variants of completer (same binary name different ommand)
140+
variant := fmt.Sprintf("%v/%v", name, file.Name())
141+
// description := readDescription(root, file.Name())
142+
description := "TODO"
143+
names = append(names, variant)
144+
descriptions[variant] = description
145+
146+
}
147+
}
148+
}
136149
}
137150
}
138151
}

completers/tealdeer_completer/main.go

-7
This file was deleted.

completers/tldr_completer/main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package main
22

3-
import "github.com/carapace-sh/carapace-bin/completers/tldr_completer/cmd"
3+
import "github.com/carapace-sh/carapace-bin/completers/tldr_completer/python/cmd"
44

55
func main() {
66
cmd.Execute()
+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package main
2+
3+
import "github.com/carapace-sh/carapace-bin/completers/tldr_completer/python/cmd"
4+
5+
func main() {
6+
cmd.Execute()
7+
}

completers/tealdeer_completer/cmd/root.go completers/tldr_completer/tealdeer/cmd/root.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ func init() {
4141
carapace.Gen(rootCmd).FlagCompletion(carapace.ActionMap{
4242
"color": carapace.ActionValues("always", "auto", "never").StyleF(style.ForKeyword),
4343
"language": os.ActionLanguages(),
44-
"platform": carapace.ActionValues("linux", "macos"),
44+
"platform": carapace.ActionValues("linux", "macos", "windows", "sunos", "osx", "android"),
4545
"render": carapace.ActionFiles(),
4646
})
4747

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package main
2+
3+
import "github.com/carapace-sh/carapace-bin/completers/tldr_completer/tealdeer/cmd"
4+
5+
func main() {
6+
cmd.Execute()
7+
}

0 commit comments

Comments
 (0)