Skip to content

Commit

Permalink
Merge pull request #2670 from carapace-sh/compose-apk
Browse files Browse the repository at this point in the history
compose: added apk
  • Loading branch information
rsteube authored Jan 1, 2025
2 parents acb787a + 1d45652 commit 0cd5007
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 10 deletions.
8 changes: 8 additions & 0 deletions .docker/apk.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
services:
apk:
build:
context: apk
image: ghcr.io/carapace-sh/carapace-bin:apk
hostname: carapace-bin:apk
volumes:
- '..:/carapace-bin:ro'
10 changes: 10 additions & 0 deletions .docker/apk/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM alpine

RUN apk add gcompat
RUN apk add --no-cache --repository=https://dl-cdn.alpinelinux.org/alpine/edge/community elvish

RUN mkdir -p ~/.config/elvish \
&& echo -e "set paths = [ /carapace-bin/cmd/carapace \$@paths ]\neval (carapace _carapace|slurp)" > ~/.config/elvish/rc.elv
ENV PATH="/carapace-bin/cmd/carapace:$PATH"

CMD ["elvish"]
11 changes: 4 additions & 7 deletions cmd/carapace/cmd/invoke.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"github.com/carapace-sh/carapace-bin/cmd/carapace/cmd/completers"
"github.com/carapace-sh/carapace-bridge/pkg/actions/bridge"
"github.com/carapace-sh/carapace-bridge/pkg/bridges"
"github.com/carapace-sh/carapace/pkg/uid"
"github.com/spf13/cobra"
)

Expand Down Expand Up @@ -233,13 +234,9 @@ func invokeCompleter(completer string) string {
out := <-outC
os.Stdout = old

executable, err := os.Executable()
if err != nil {
panic(err.Error()) // TODO exit with error message
}
executableName := filepath.Base(executable)
patched := strings.Replace(string(out), fmt.Sprintf("%v _carapace", executableName), fmt.Sprintf("%v %v", executableName, completer), -1) // general callback
patched = strings.Replace(patched, fmt.Sprintf("'%v', '_carapace'", executableName), fmt.Sprintf("'%v', '%v'", executableName, completer), -1) // xonsh callback
executable := uid.Executable()
patched := strings.Replace(string(out), fmt.Sprintf("%v _carapace", executable), fmt.Sprintf("%v %v", executable, completer), -1) // general callback
patched = strings.Replace(patched, fmt.Sprintf("'%v', '_carapace'", executable), fmt.Sprintf("'%v', '%v'", executable, completer), -1) // xonsh callback
return patched
}

Expand Down
1 change: 1 addition & 0 deletions compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ include:
# shells and build related services
- .docker/carapace.yaml
# tools
- .docker/apk.yaml
- .docker/bloop.yaml
- .docker/fzf-tab.yaml
- .docker/gcloud.yaml
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/carapace-sh/carapace-bin
go 1.23.1

require (
github.com/carapace-sh/carapace v1.5.2
github.com/carapace-sh/carapace v1.5.3
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
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
github.com/carapace-sh/carapace v1.5.2 h1:ddFLVzPLmEUnKTtglMDDnfbFSYyCMEd0xn1ysguSWLw=
github.com/carapace-sh/carapace v1.5.2/go.mod h1:djegtVDi/3duSAqZNU+/nCq7XtDRMRZUb5bW0O/HnEs=
github.com/carapace-sh/carapace v1.5.3 h1:mDLq48Q01OBFUFqGoCEvHt3nh+hntmQEiTQ7OsyI8fg=
github.com/carapace-sh/carapace v1.5.3/go.mod h1:djegtVDi/3duSAqZNU+/nCq7XtDRMRZUb5bW0O/HnEs=
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=
Expand Down

0 comments on commit 0cd5007

Please sign in to comment.