Skip to content

Instantly share code, notes, and snippets.

@angelo-v
Created February 25, 2026 16:12
Show Gist options
  • Select an option

  • Save angelo-v/dc96f26374369b8667215762a9cb3680 to your computer and use it in GitHub Desktop.

Select an option

Save angelo-v/dc96f26374369b8667215762a9cb3680 to your computer and use it in GitHub Desktop.
Bash/Zsh wrapper that overrides claude to require an explicit workspace argument and automatically maps it to ~/.claude/settings.<workspace>.json, failing if no workspace or matching settings file is provided while transparently forwarding all additional CLI arguments.
claude() {
if [[ $# -lt 1 ]]; then
echo "Usage: claude <workspace> [args...]" >&2
return 1
fi
local workspace="$1"
shift
local settings_file="$HOME/.claude/settings.${workspace}.json"
if [[ ! -f "$settings_file" ]]; then
echo "Error: Settings file not found: $settings_file" >&2
return 1
fi
command claude --settings "$settings_file" "$@"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment