feat(02-01): refactor flag parsing to while/shift with CLAUDE_ARGS accumulator
This commit is contained in:
parent
daf47bd094
commit
72ba48d004
1 changed files with 16 additions and 7 deletions
23
claudebox.sh
23
claudebox.sh
|
|
@ -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)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue