Add --config flag for custom settings file path#166
Open
stuartc wants to merge 3 commits intosirmalloc:mainfrom
Open
Add --config flag for custom settings file path#166stuartc wants to merge 3 commits intosirmalloc:mainfrom
stuartc wants to merge 3 commits intosirmalloc:mainfrom
Conversation
Allow users to specify an alternative settings file via `--config <path>`, enabling distinct status line configs for different Claude Code instances. - Add initConfigPath/getConfigPath/isCustomConfigPath to config.ts - Fix backup path to always append .bak instead of replacing .json suffix - Use path.dirname(SETTINGS_PATH) instead of CONFIG_DIR for mkdir - Parse --config arg in ccstatusline.ts main() entry point - Add tests for config path management
When a custom config path is active, the install-to-Claude-Code feature now appends --config <path> to the status line command. Also updates isInstalled detection to recognize commands with the --config suffix. - Add isKnownCommand() to deduplicate command-matching logic - Add shell-safe path quoting for --config values with spaces/special chars - Add buildCommand() to append --config when custom path is active - Refactor isInstalled() to use isKnownCommand() - Use isKnownCommand() in App.tsx install flow - Add tests for isKnownCommand() and buildCommand() with CLAUDE_CONFIG_DIR safety net
When a custom --config path is active, display it below the title bar so users can see which settings file is being edited.
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.
Summary
Adds a
--config <path>flag that lets users point ccstatusline at an alternative settings file. This is handy when you want distinct status line configurations for different Claude Code instances (e.g. per-project or per-workspace).--configCLI flag — parsed early inmain()and wired throughinitConfigPath()/getConfigPath()/isCustomConfigPath()inconfig.ts--config <path>appended automatically, with shell-safe quoting for paths containing spaces or special charactersisKnownCommand()helper — replaces the duplicated array-of-known-commands pattern and correctly matches both bare commands and commands with a--configsuffixTest plan
initConfigPath/getConfigPath/isCustomConfigPath(config-dir.test.ts)isKnownCommandandbuildCommandviainstallStatusLine(claude-settings.test.ts)bun run start -- --config /tmp/test-settings.json, confirm TUI shows the path and saves to the right file--config