feat(02-01): refactor flag parsing to while/shift with CLAUDE_ARGS accumulator

This commit is contained in:
Christopher Mühl 2026-04-09 17:09:56 +02:00
parent daf47bd094
commit 72ba48d004
No known key found for this signature in database
GPG key ID: 925AC7D69955293F

View file

@ -1,11 +1,20 @@
# Parse claudebox flags # Parse claudebox flags
SKIP_AUDIT=false
DRY_RUN=false
CHECK_MODE=false
SHELL_MODE=false SHELL_MODE=false
for arg in "$@"; do CLAUDE_ARGS=()
case "$arg" in
--shell) SHELL_MODE=true; shift; break ;; while (( $# > 0 )); do
--) shift; break ;; case "$1" in
*) break ;; --yes|-y) SKIP_AUDIT=true ;;
--dry-run) DRY_RUN=true ;;
--check) CHECK_MODE=true ;;
--shell) SHELL_MODE=true ;;
--) shift; CLAUDE_ARGS+=("$@"); break ;;
*) CLAUDE_ARGS+=("$1") ;;
esac esac
shift
done done
# SANDBOX_PATH is injected by flake.nix via makeBinPath (only runtimeInputs, no host PATH) # SANDBOX_PATH is injected by flake.nix via makeBinPath (only runtimeInputs, no host PATH)
@ -68,9 +77,9 @@ fi
# Build sandbox command # Build sandbox command
if [[ "$SHELL_MODE" == true ]]; then if [[ "$SHELL_MODE" == true ]]; then
SANDBOX_CMD=("$SANDBOX_BASH" "$@") SANDBOX_CMD=("$SANDBOX_BASH" "${CLAUDE_ARGS[@]}")
else else
SANDBOX_CMD=("$CLAUDE_BIN" --dangerously-skip-permissions "$@") SANDBOX_CMD=("$CLAUDE_BIN" --dangerously-skip-permissions "${CLAUDE_ARGS[@]}")
fi fi
# exec bwrap (SAND-04 through SAND-15, UX-06, D-01) # exec bwrap (SAND-04 through SAND-15, UX-06, D-01)