Skip to content

feat: ccswitch exec runs any command as a profile - #11

Merged
NotAProgrammer187 merged 1 commit into
mainfrom
feat/exec
Sep 22, 2026
Merged

NotAProgrammer187 merged 1 commit into
mainfrom
feat/exec

Conversation

@NotAProgrammer187

Copy link
Copy Markdown
Owner

ccswitch run only launches Claude Code, but a profile is just an environment and other things read it too: the VS Code extension, claude mcp add, scripts that call claude -p.

ccswitch exec <profile> -- <command...> runs any command with the profile's CLAUDE_CONFIG_DIR set. It keeps run's manners: shared defaults are written first, ANTHROPIC_API_KEY / ANTHROPIC_AUTH_TOKEN are stripped, Ctrl-C belongs to the child, the exit code passes straight back, and --best and the linked-directory fallback work the same way.

Also in this PR:

  • tab completion knows exec (profile after it, --best flag, then the shell completes the command)
  • claudeCommand renamed to childCommand now that it runs more than claude
  • README: new section, usage-table row, and the "Pin a shell to a profile" heading that the statusline change dropped is restored

Verified locally on Windows: env reaches the child, key stripped, exit code 7 passes through, missing binary errors cleanly, go vet and go test pass.

`ccswitch run` only launches Claude Code, but a profile is an environment,
and other things read it too: the VS Code extension, `claude mcp add`, a
script that drives `claude -p`. `ccswitch exec <profile> -- <command...>`
runs any of them with the profile's CLAUDE_CONFIG_DIR set. It keeps run's
manners: shared defaults are written first, the API-key variables are
stripped, Ctrl-C belongs to the child, the exit code passes straight back,
and `--best` and the linked-directory fallback work the same way.

Also: tab completion knows `exec`, the helper that runs .cmd shims through
cmd.exe is renamed childCommand now that it runs more than claude, and the
README gets back the "Pin a shell to a profile" heading the statusline
change dropped.
@NotAProgrammer187
NotAProgrammer187 merged commit 980f2e2 into main Sep 22, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant