Repository navigation
feat: ccswitch exec runs any command as a profile - #11
Merged
Merged
Conversation
`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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ccswitch runonly 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 callclaude -p.ccswitch exec <profile> -- <command...>runs any command with the profile'sCLAUDE_CONFIG_DIRset. It keepsrun's manners: shared defaults are written first,ANTHROPIC_API_KEY/ANTHROPIC_AUTH_TOKENare stripped, Ctrl-C belongs to the child, the exit code passes straight back, and--bestand the linked-directory fallback work the same way.Also in this PR:
exec(profile after it,--bestflag, then the shell completes the command)claudeCommandrenamed tochildCommandnow that it runs more than claudeVerified locally on Windows: env reaches the child, key stripped, exit code 7 passes through, missing binary errors cleanly,
go vetandgo testpass.