Fix problem with arguments

It was impossible to have several arguments while calling
opencode in the container like `opencode auth list`, it would
just break. With this change this also works.
This commit is contained in:
Jeena 2026-01-14 10:50:42 +09:00
parent 39edc252f0
commit f479a613a0

View file

@ -1,13 +1,16 @@
OPENCODE_CONTAINER_DIR="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)" OPENCODE_CONTAINER_DIR="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
opencode() { opencode() {
UID=$(id -u) \ local uid=$(id -u)
GID=$(id -g) \ local gid=$(id -g)
USER=$(whoami) \ local user=$(whoami)
UID="$uid" \
GID="$gid" \
USER="$user" \
docker compose \ docker compose \
-f "$OPENCODE_CONTAINER_DIR/docker-compose.yaml" \ -f "$OPENCODE_CONTAINER_DIR/docker-compose.yaml" \
run --rm \ run --rm \
-u "$UID:$GID" \ -u "$uid:$gid" \
opencode bash -c "/home/$USER/.opencode/bin/opencode \"$@\"" \ opencode /home/"$user"/.opencode/bin/opencode "$@" \
2> >(grep -v "No services to build" >&2) 2> >(grep -v "No services to build" >&2)
} }