Skip to content

Commit

Permalink
Merge pull request #184 from rsteube/bridges-map
Browse files Browse the repository at this point in the history
provided access to all bridges
  • Loading branch information
rsteube committed Jan 31, 2024
2 parents 3273bd1 + e5c06f9 commit a62f82c
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions pkg/bridges/bridges.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
package bridges

import (
"github.com/rsteube/carapace-bridge/pkg/env"
)

func filter(m map[string]bool, filter ...[]string) map[string]bool {
for _, f := range filter {
for _, e := range f {
Expand All @@ -8,3 +12,22 @@ func filter(m map[string]bool, filter ...[]string) map[string]bool {
}
return m
}

func Bridges() map[string]string {
m := Config()
for _, bridge := range env.Bridges() {
if f, ok := map[string]func() []string{
"bash": Bash,
"fish": Fish,
"inshellisens": Inshellisense,
"zsh": Zsh,
}[bridge]; ok {
for _, name := range f() {
if _, ok := m[name]; !ok {
m[name] = bridge
}
}
}
}
return m
}

0 comments on commit a62f82c

Please sign in to comment.