Skip to content

Commit

Permalink
Merge pull request #950 from rsteube/bash-ble
Browse files Browse the repository at this point in the history
support bash-ble
  • Loading branch information
rsteube authored Feb 20, 2022
2 parents b554682 + 7554b60 commit 1b4cb49
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 4 deletions.
10 changes: 10 additions & 0 deletions cmd/carapace/cmd/lazyInit.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,16 @@ complete -F _carapace_lazy %v
return fmt.Sprintf(snippet, strings.Join(completers, " "))
}

func bash_ble_lazy(completers []string) string {
snippet := `_carapace_lazy() {
source <(carapace $1 bash-ble)
$"_$1_completion"
}
complete -F _carapace_lazy %v
`
return fmt.Sprintf(snippet, strings.Join(completers, " "))
}

func elvish_lazy(completers []string) string {
snippet := `put %v | each {|c|
set edit:completion:arg-completer[$c] = {|@arg|
Expand Down
2 changes: 2 additions & 0 deletions cmd/carapace/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ var rootCmd = &cobra.Command{
switch shell {
case "bash":
fmt.Println(bash_lazy(completers))
case "bash-ble":
fmt.Println(bash_ble_lazy(completers))
case "elvish":
fmt.Println(elvish_lazy(completers))
case "fish":
Expand Down
2 changes: 1 addition & 1 deletion completers/carapace_completer/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func posCmd() *cobra.Command {

carapace.Gen(cmd).PositionalCompletion(
ActionCompleters(),
carapace.ActionValues("bash", "elvish", "export", "fish", "ion", "nushell", "oil", "powershell", "tcsh", "xonsh", "zsh"),
carapace.ActionValues("bash", "bash-ble", "elvish", "export", "fish", "ion", "nushell", "oil", "powershell", "tcsh", "xonsh", "zsh"),
carapace.ActionCallback(func(c carapace.Context) carapace.Action {
return carapace.ActionValues(c.Args[0])
}),
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
github.com/mitchellh/go-homedir v1.1.0
github.com/mitchellh/go-ps v1.0.0
github.com/pelletier/go-toml v1.9.4
github.com/rsteube/carapace v0.14.0
github.com/rsteube/carapace v0.15.0
github.com/spf13/cobra v1.3.0
github.com/spf13/pflag v1.0.5
golang.org/x/sys v0.0.0-20211205182925-97ca703d548d
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -302,8 +302,8 @@ github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsT
github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A=
github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/rsteube/carapace v0.14.0 h1:J10+vwi0J3crdb/0QJ0gQlhG9cZ0aKDLCojQ8LcfZCo=
github.com/rsteube/carapace v0.14.0/go.mod h1:D1Uvsm1mdx8rlM58FbqzswL/M0i9VGoTOX6wHKuByf8=
github.com/rsteube/carapace v0.15.0 h1:T+0z9lRM7d11kzppqRxNZ8tOwuo8hUhEDBvPPyx++wI=
github.com/rsteube/carapace v0.15.0/go.mod h1:D1Uvsm1mdx8rlM58FbqzswL/M0i9VGoTOX6wHKuByf8=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
github.com/sagikazarmark/crypt v0.3.0/go.mod h1:uD/D+6UF4SrIR1uGEv7bBNkNqLGqUr43MRiaGWX1Nig=
Expand Down

0 comments on commit 1b4cb49

Please sign in to comment.