mirror of
https://github.com/rsteube/carapace-bin.git
synced 2025-05-05 15:32:53 +00:00
gcloud: fix bridge
This commit is contained in:
parent
ce79290103
commit
5aee54efaf
8
.docker/gcloud.yaml
Normal file
8
.docker/gcloud.yaml
Normal file
@ -0,0 +1,8 @@
|
||||
services:
|
||||
gcloud:
|
||||
build:
|
||||
context: gcloud
|
||||
image: ghcr.io/carapace-sh/carapace-bin:gcloud
|
||||
hostname: carapace-bin:gcloud
|
||||
volumes:
|
||||
- '..:/carapace-bin:ro'
|
10
.docker/gcloud/Dockerfile
Normal file
10
.docker/gcloud/Dockerfile
Normal file
@ -0,0 +1,10 @@
|
||||
FROM gcr.io/google.com/cloudsdktool/google-cloud-cli:stable
|
||||
|
||||
RUN apt-get update && apt-get install -y curl
|
||||
RUN curl -so - https://dl.elv.sh/linux-amd64/elvish-HEAD.tar.gz | tar -xzvC /usr/local/bin
|
||||
|
||||
RUN mkdir -p ~/.config/elvish \
|
||||
&& echo "set paths = [ /carapace-bin/cmd/carapace \$@paths ]\neval (carapace _carapace|slurp)" > ~/.config/elvish/rc.elv
|
||||
ENV PATH="/carapace-bin/cmd/carapace:$PATH"
|
||||
|
||||
CMD ["elvish"]
|
@ -177,40 +177,42 @@ func macros() {
|
||||
`bridge "github.com/carapace-sh/carapace-bridge/pkg/actions/bridge"`: true,
|
||||
}
|
||||
macros := []string{
|
||||
`"bridge.Argcomplete": spec.MacroV(bridge.ActionArgcomplete),`,
|
||||
`"bridge.Bash": spec.MacroV(bridge.ActionBash),`,
|
||||
`"bridge.Carapace": spec.MacroV(bridge.ActionCarapace),`,
|
||||
`"bridge.CarapaceBin": spec.MacroV(bridge.ActionCarapaceBin),`,
|
||||
`"bridge.Clap": spec.MacroV(bridge.ActionClap),`,
|
||||
`"bridge.Click": spec.MacroV(bridge.ActionClick),`,
|
||||
`"bridge.Cobra": spec.MacroV(bridge.ActionCobra),`,
|
||||
`"bridge.Complete": spec.MacroV(bridge.ActionComplete),`,
|
||||
`"bridge.Fish": spec.MacroV(bridge.ActionFish),`,
|
||||
`"bridge.Inshellisense": spec.MacroV(bridge.ActionInshellisense),`,
|
||||
`"bridge.Kingpin": spec.MacroV(bridge.ActionKingpin),`,
|
||||
`"bridge.Macro": spec.MacroV(bridge.ActionMacro),`,
|
||||
`"bridge.Powershell": spec.MacroV(bridge.ActionPowershell),`,
|
||||
`"bridge.Urfavecli": spec.MacroV(bridge.ActionUrfavecli),`,
|
||||
`"bridge.Yargs": spec.MacroV(bridge.ActionYargs),`,
|
||||
`"bridge.Zsh": spec.MacroV(bridge.ActionZsh),`,
|
||||
`"bridge.Argcomplete": spec.MacroV(bridge.ActionArgcomplete),`,
|
||||
`"bridge.ArgcompleteLegacy": spec.MacroV(bridge.ActionArgcompleteLegacy), //lint:ignore SA1019 gcloud uses an old argcomplete version`,
|
||||
`"bridge.Bash": spec.MacroV(bridge.ActionBash),`,
|
||||
`"bridge.Carapace": spec.MacroV(bridge.ActionCarapace),`,
|
||||
`"bridge.CarapaceBin": spec.MacroV(bridge.ActionCarapaceBin),`,
|
||||
`"bridge.Clap": spec.MacroV(bridge.ActionClap),`,
|
||||
`"bridge.Click": spec.MacroV(bridge.ActionClick),`,
|
||||
`"bridge.Cobra": spec.MacroV(bridge.ActionCobra),`,
|
||||
`"bridge.Complete": spec.MacroV(bridge.ActionComplete),`,
|
||||
`"bridge.Fish": spec.MacroV(bridge.ActionFish),`,
|
||||
`"bridge.Inshellisense": spec.MacroV(bridge.ActionInshellisense),`,
|
||||
`"bridge.Kingpin": spec.MacroV(bridge.ActionKingpin),`,
|
||||
`"bridge.Macro": spec.MacroV(bridge.ActionMacro),`,
|
||||
`"bridge.Powershell": spec.MacroV(bridge.ActionPowershell),`,
|
||||
`"bridge.Urfavecli": spec.MacroV(bridge.ActionUrfavecli),`,
|
||||
`"bridge.Yargs": spec.MacroV(bridge.ActionYargs),`,
|
||||
`"bridge.Zsh": spec.MacroV(bridge.ActionZsh),`,
|
||||
}
|
||||
descriptions := map[string]string{
|
||||
"bridge.Argcomplete": "bridges https://github.com/kislyuk/argcomplete",
|
||||
"bridge.Bash": "bridges https://www.gnu.org/software/bash/",
|
||||
"bridge.Carapace": "bridges https://github.com/carapace-sh/carapace",
|
||||
"bridge.CarapaceBin": "bridges https://github.com/carapace-sh/carapace-bin",
|
||||
"bridge.Clap": "bridges https://github.com/clap-rs/clap",
|
||||
"bridge.Click": "bridges https://github.com/pallets/click",
|
||||
"bridge.Cobra": "bridges https://github.com/spf13/cobra",
|
||||
"bridge.Complete": "bridges https://github.com/posener/complete",
|
||||
"bridge.Fish": "bridges https://fishshell.com/",
|
||||
"bridge.Inshellisense": "bridges https://github.com/microsoft/inshellisense",
|
||||
"bridge.Kingpin": "bridges https://github.com/alecthomas/kingpin",
|
||||
"bridge.Macro": "bridges macros exposed with https://github.com/carapace-sh/carapace-spec",
|
||||
"bridge.Powershell": "bridges https://microsoft.com/powershell",
|
||||
"bridge.Urfavecli": "bridges https://github.com/urfave/cli",
|
||||
"bridge.Yargs": "bridges https://github.com/yargs/yargs",
|
||||
"bridge.Zsh": "bridges https://www.zsh.org/",
|
||||
"bridge.Argcomplete": "bridges https://github.com/kislyuk/argcomplete",
|
||||
"bridge.ArgcompleteLegacy": "bridges https://github.com/kislyuk/argcomplete",
|
||||
"bridge.Bash": "bridges https://www.gnu.org/software/bash/",
|
||||
"bridge.Carapace": "bridges https://github.com/carapace-sh/carapace",
|
||||
"bridge.CarapaceBin": "bridges https://github.com/carapace-sh/carapace-bin",
|
||||
"bridge.Clap": "bridges https://github.com/clap-rs/clap",
|
||||
"bridge.Click": "bridges https://github.com/pallets/click",
|
||||
"bridge.Cobra": "bridges https://github.com/spf13/cobra",
|
||||
"bridge.Complete": "bridges https://github.com/posener/complete",
|
||||
"bridge.Fish": "bridges https://fishshell.com/",
|
||||
"bridge.Inshellisense": "bridges https://github.com/microsoft/inshellisense",
|
||||
"bridge.Kingpin": "bridges https://github.com/alecthomas/kingpin",
|
||||
"bridge.Macro": "bridges macros exposed with https://github.com/carapace-sh/carapace-spec",
|
||||
"bridge.Powershell": "bridges https://microsoft.com/powershell",
|
||||
"bridge.Urfavecli": "bridges https://github.com/urfave/cli",
|
||||
"bridge.Yargs": "bridges https://github.com/yargs/yargs",
|
||||
"bridge.Zsh": "bridges https://www.zsh.org/",
|
||||
}
|
||||
|
||||
r := regexp.MustCompile(`^func Action(?P<name>[^(]+)\((?P<arg>[^(]*)\) carapace.Action {$`)
|
||||
|
@ -26,10 +26,11 @@ func init() {
|
||||
// TODO patch user@instance and --flag=optarg as in gcloud completion script
|
||||
|
||||
if c.Value == "-" {
|
||||
return carapace.ActionValues("--").NoSpace() // seems shorthand flags aren't completed anyway so expand to longhand first
|
||||
c.Value = "--" // seems shorthand flags aren't completed anyway so expand to longhand first
|
||||
}
|
||||
c.Setenv("CLOUDSDK_COMPONENT_MANAGER_DISABLE_UPDATE_CHECK", "1")
|
||||
return bridge.ActionArgcomplete("gcloud").Invoke(c).ToA()
|
||||
//lint:ignore SA1019 gcloud uses an old argcomplete version
|
||||
return bridge.ActionArgcompleteLegacy("gcloud").Invoke(c).ToA()
|
||||
}),
|
||||
)
|
||||
}
|
||||
|
@ -3,4 +3,5 @@ include:
|
||||
- .docker/carapace.yaml
|
||||
# tools
|
||||
- .docker/bloop.yaml
|
||||
- .docker/gcloud.yaml
|
||||
- .docker/nix.yaml
|
||||
|
2
go.mod
2
go.mod
@ -4,7 +4,7 @@ go 1.23.1
|
||||
|
||||
require (
|
||||
github.com/carapace-sh/carapace v1.5.0
|
||||
github.com/carapace-sh/carapace-bridge v1.2.1
|
||||
github.com/carapace-sh/carapace-bridge v1.2.2
|
||||
github.com/carapace-sh/carapace-selfupdate v0.0.8
|
||||
github.com/carapace-sh/carapace-shlex v1.0.1
|
||||
github.com/carapace-sh/carapace-spec v1.1.0
|
||||
|
4
go.sum
4
go.sum
@ -1,7 +1,7 @@
|
||||
github.com/carapace-sh/carapace v1.5.0 h1:rjNMTo5sY3YybMKbzEuaM19HEG6JXhvCTOrioV0QUHY=
|
||||
github.com/carapace-sh/carapace v1.5.0/go.mod h1:djegtVDi/3duSAqZNU+/nCq7XtDRMRZUb5bW0O/HnEs=
|
||||
github.com/carapace-sh/carapace-bridge v1.2.1 h1:OtCA4/8+0zTpVDusqF4p0hzYjawMTlZBl37u6ImIjdo=
|
||||
github.com/carapace-sh/carapace-bridge v1.2.1/go.mod h1:HpN3iEdCmQtAD1pd/qHEnWmAF719CeNyJrY8FJ5/E4o=
|
||||
github.com/carapace-sh/carapace-bridge v1.2.2 h1:Zlzw7BajF4iHAFBClCYcptEG+7+F324dFyiGzGiU/kw=
|
||||
github.com/carapace-sh/carapace-bridge v1.2.2/go.mod h1:HpN3iEdCmQtAD1pd/qHEnWmAF719CeNyJrY8FJ5/E4o=
|
||||
github.com/carapace-sh/carapace-pflag v1.0.0 h1:uJMhl+vwEM/Eb0UdxZUuv4jo4rUAyPijkRGP5gfCuCE=
|
||||
github.com/carapace-sh/carapace-pflag v1.0.0/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||
github.com/carapace-sh/carapace-selfupdate v0.0.8 h1:gvZCzPw3MmEQpN+KwLThod4mXKl0kx/p+QVHIs0L4dM=
|
||||
|
Loading…
x
Reference in New Issue
Block a user