mirror of
https://github.com/rsteube/carapace-bin.git
synced 2025-05-05 15:32:53 +00:00
parent
3f5bed15b2
commit
2298c0a5aa
@ -8,16 +8,30 @@ import (
|
|||||||
func Fish(completers []string) string {
|
func Fish(completers []string) string {
|
||||||
snippet := `%v%v
|
snippet := `%v%v
|
||||||
|
|
||||||
function _carapace_lazy
|
function _carapace_quote_suffix
|
||||||
complete -c $argv[1] -e
|
if not commandline -cp | xargs echo 2>/dev/null >/dev/null
|
||||||
carapace $argv[1] fish | source
|
if commandline -cp | sed 's/$/"/'| xargs echo 2>/dev/null >/dev/null
|
||||||
complete --do-complete=(commandline -cp)
|
echo '"'
|
||||||
|
else if commandline -cp | sed "s/\$/'/"| xargs echo 2>/dev/null >/dev/null
|
||||||
|
echo "'"
|
||||||
|
end
|
||||||
|
else
|
||||||
|
echo ""
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function _carapace_callback
|
||||||
|
commandline -cp | sed "s/\$/"(_carapace_quote_suffix)"/" | sed "s/ \$/ ''/" | xargs carapace $argv[1] fish
|
||||||
|
end
|
||||||
|
|
||||||
%v
|
%v
|
||||||
`
|
`
|
||||||
complete := make([]string, len(completers))
|
complete := make([]string, 0, len(completers)*2)
|
||||||
for index, completer := range completers {
|
for _, completer := range completers {
|
||||||
complete[index] = fmt.Sprintf(`complete -c '%v' -f -a '(_carapace_lazy %v)'`, completer, completer)
|
complete = append(complete,
|
||||||
|
fmt.Sprintf(`complete -e '%v'`, completer),
|
||||||
|
fmt.Sprintf(`complete -c '%v' -f -a '(_carapace_callback %v)'`, completer, completer),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
return fmt.Sprintf(snippet, pathSnippet("fish"), envSnippet("fish"), strings.Join(complete, "\n"))
|
return fmt.Sprintf(snippet, pathSnippet("fish"), envSnippet("fish"), strings.Join(complete, "\n"))
|
||||||
}
|
}
|
||||||
|
@ -3,3 +3,13 @@
|
|||||||

|

|
||||||
|
|
||||||
Under development.
|
Under development.
|
||||||
|
|
||||||
|
|
||||||
|
## Fish
|
||||||
|
|
||||||
|
With [4.0b1](https://github.com/fish-shell/fish-shell/releases/tag/4.0b1) onwards the following workaround is not needed anymore:
|
||||||
|
```sh
|
||||||
|
mkdir -p ~/.config/fish/completions
|
||||||
|
carapace --list | awk '{print $1}' | xargs -I{} touch ~/.config/fish/completions/{}.fish # disable auto-loaded completions (#185)
|
||||||
|
```
|
||||||
|
see [fish-shell/fish#6716](https://github.com/fish-shell/fish-shell/issues/6716)
|
||||||
|
@ -39,13 +39,18 @@ eval (carapace _carapace|slurp)
|
|||||||
```sh
|
```sh
|
||||||
# ~/.config/fish/config.fish
|
# ~/.config/fish/config.fish
|
||||||
set -Ux CARAPACE_BRIDGES 'zsh,fish,bash,inshellisense' # optional
|
set -Ux CARAPACE_BRIDGES 'zsh,fish,bash,inshellisense' # optional
|
||||||
mkdir -p ~/.config/fish/completions
|
|
||||||
carapace --list | awk '{print $1}' | xargs -I{} touch ~/.config/fish/completions/{}.fish # disable auto-loaded completions (#185)
|
|
||||||
carapace _carapace | source
|
carapace _carapace | source
|
||||||
```
|
```
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
> With [4.0b1](https://github.com/fish-shell/fish-shell/releases/tag/4.0b1) onwards the following workaround is not needed anymore:
|
||||||
|
> ```sh
|
||||||
|
> mkdir -p ~/.config/fish/completions
|
||||||
|
> carapace --list | awk '{print $1}' | xargs -I{} touch ~/.config/fish/completions/{}.fish # disable auto-loaded completions (#185)
|
||||||
|
> ```
|
||||||
|
> see [fish-shell/fish#6716](https://github.com/fish-shell/fish-shell/issues/6716)
|
||||||
|
|
||||||
## Nushell
|
## Nushell
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
|
2
go.mod
2
go.mod
@ -3,7 +3,7 @@ module github.com/carapace-sh/carapace-bin
|
|||||||
go 1.23.1
|
go 1.23.1
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/carapace-sh/carapace v1.7.0
|
github.com/carapace-sh/carapace v1.7.1
|
||||||
github.com/carapace-sh/carapace-bridge v1.2.3
|
github.com/carapace-sh/carapace-bridge v1.2.3
|
||||||
github.com/carapace-sh/carapace-selfupdate v0.0.10
|
github.com/carapace-sh/carapace-selfupdate v0.0.10
|
||||||
github.com/carapace-sh/carapace-shlex v1.0.1
|
github.com/carapace-sh/carapace-shlex v1.0.1
|
||||||
|
4
go.sum
4
go.sum
@ -1,5 +1,5 @@
|
|||||||
github.com/carapace-sh/carapace v1.7.0 h1:uJK6qvrXow6ZylbjGrU1pEyFCg0ZQ/L951GcIdl2C7U=
|
github.com/carapace-sh/carapace v1.7.1 h1:GjMjPNEMHhTstneZD2M3Ypjb+lW5YNEV1AfYmRhsG4c=
|
||||||
github.com/carapace-sh/carapace v1.7.0/go.mod h1:fHdo3nEFe1QnIXxeA/Z1O9dCI83sfCsKfxrogpHfgtM=
|
github.com/carapace-sh/carapace v1.7.1/go.mod h1:fHdo3nEFe1QnIXxeA/Z1O9dCI83sfCsKfxrogpHfgtM=
|
||||||
github.com/carapace-sh/carapace-bridge v1.2.3 h1:lalVNRCyUqdPAJbrqkmIDKNnZYsBlo83JBsdP9WFzKM=
|
github.com/carapace-sh/carapace-bridge v1.2.3 h1:lalVNRCyUqdPAJbrqkmIDKNnZYsBlo83JBsdP9WFzKM=
|
||||||
github.com/carapace-sh/carapace-bridge v1.2.3/go.mod h1:rEOS3MgzTQrCssS8WunHxPz31jZYNudcA7w1W5HrJs0=
|
github.com/carapace-sh/carapace-bridge v1.2.3/go.mod h1:rEOS3MgzTQrCssS8WunHxPz31jZYNudcA7w1W5HrJs0=
|
||||||
github.com/carapace-sh/carapace-pflag v1.0.0 h1:uJMhl+vwEM/Eb0UdxZUuv4jo4rUAyPijkRGP5gfCuCE=
|
github.com/carapace-sh/carapace-pflag v1.0.0 h1:uJMhl+vwEM/Eb0UdxZUuv4jo4rUAyPijkRGP5gfCuCE=
|
||||||
|
Loading…
x
Reference in New Issue
Block a user