Skip to content

Commit

Permalink
tldr: support variants
Browse files Browse the repository at this point in the history
  • Loading branch information
rsteube committed Apr 18, 2024
1 parent 49418e2 commit 8375592
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 9 deletions.
13 changes: 13 additions & 0 deletions cmd/carapace-generate/gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,19 @@ func readCompleters() ([]string, map[string]string) {
description := readDescription(root, file.Name())
names = append(names, name)
descriptions[name] = description

if files, err := os.ReadDir(root + "/completers/" + file.Name()); err == nil {
for _, file := range files {
if file.IsDir() && file.Name() != "cmd" { // variants of completer (same binary name different ommand)
variant := fmt.Sprintf("%v/%v", name, file.Name())
// description := readDescription(root, file.Name())
description := "TODO"
names = append(names, variant)
descriptions[variant] = description

}
}
}
}
}
}
Expand Down
7 changes: 0 additions & 7 deletions completers/tealdeer_completer/main.go

This file was deleted.

2 changes: 1 addition & 1 deletion completers/tldr_completer/main.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package main

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

func main() {
cmd.Execute()
Expand Down
File renamed without changes.
7 changes: 7 additions & 0 deletions completers/tldr_completer/python/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package main

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

func main() {
cmd.Execute()
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func init() {
carapace.Gen(rootCmd).FlagCompletion(carapace.ActionMap{
"color": carapace.ActionValues("always", "auto", "never").StyleF(style.ForKeyword),
"language": os.ActionLanguages(),
"platform": carapace.ActionValues("linux", "macos"),
"platform": carapace.ActionValues("linux", "macos", "windows", "sunos", "osx", "android"),
"render": carapace.ActionFiles(),
})

Expand Down
7 changes: 7 additions & 0 deletions completers/tldr_completer/tealdeer/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package main

import "github.com/carapace-sh/carapace-bin/completers/tldr_completer/tealdeer/cmd"

func main() {
cmd.Execute()
}

0 comments on commit 8375592

Please sign in to comment.