Skip to content

Commit

Permalink
Merge pull request #1053 from rsteube/update-carapace
Browse files Browse the repository at this point in the history
updated carapace to v0.19.6
  • Loading branch information
rsteube authored Apr 22, 2022
2 parents c6daf01 + 90f9284 commit b0e9c16
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
21 changes: 18 additions & 3 deletions cmd/carapace/cmd/lazyInit.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,26 @@ complete -c '%v' -f -a '(_carapace_lazy %v)'`, completer, completer, completer)
}

func nushell_lazy(completers []string) string {
snippet := make([]string, len(completers))
exports := make([]string, len(completers))
for index, completer := range completers {
snippet[index] = fmt.Sprintf(`config set completion.%v [carapace %v nushell _]`, completer, completer)
exports[index] = fmt.Sprintf(` export extern "%v" [
...args: string@"nu-complete carapace"
]`, completer)
}
return strings.Join(snippet, "\n")
return fmt.Sprintf(`module carapace {
def "nu-complete carapace" [line: string, pos: int] {
let words = ($line | str substring [0 $pos] | split row " ")
if ($line | str substring [0 $pos] | str ends-with " ") {
carapace $words.0 nushell ($words | append "") | from json
} else {
carapace $words.0 nushell $words | from json
}
}
%v
}
use carapace *
`, strings.Join(exports, "\n"))
}

func oil_lazy(completers []string) string {
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.5
github.com/rsteube/carapace v0.19.5
github.com/rsteube/carapace v0.19.6
github.com/spf13/cobra v1.4.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 @@ -13,8 +13,8 @@ github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3v
github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/rsteube/carapace v0.19.5 h1:VPrHbswk0KucIE+kS7CjPCRciqQO0Ham09XGWIYU+L8=
github.com/rsteube/carapace v0.19.5/go.mod h1:GgiwpPVhucHNOv0AmtIkxhiEFkCMP5BBRauyQLP0mFY=
github.com/rsteube/carapace v0.19.6 h1:8J+Ln3lzccYnJRGzPPvFGtdZRlYiL2qZ2NhbEgP46DU=
github.com/rsteube/carapace v0.19.6/go.mod h1:GgiwpPVhucHNOv0AmtIkxhiEFkCMP5BBRauyQLP0mFY=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/spf13/cobra v1.4.0 h1:y+wJpx64xcgO1V+RcnwW0LEHxTKRi2ZDPSBjWnrg88Q=
github.com/spf13/cobra v1.4.0/go.mod h1:Wo4iy3BUC+X2Fybo0PDqwJIv3dNRiZLHQymsfxlB84g=
Expand Down

0 comments on commit b0e9c16

Please sign in to comment.