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() {
UID=$(id -u) \
GID=$(id -g) \
USER=$(whoami) \
local uid=$(id -u)
local gid=$(id -g)
local user=$(whoami)
UID="$uid" \
GID="$gid" \
USER="$user" \
docker compose \
-f "$OPENCODE_CONTAINER_DIR/docker-compose.yaml" \
run --rm \
-u "$UID:$GID" \
opencode bash -c "/home/$USER/.opencode/bin/opencode \"$@\"" \
-u "$uid:$gid" \
opencode /home/"$user"/.opencode/bin/opencode "$@" \
2> >(grep -v "No services to build" >&2)
}