Add --home CLI flag and TOML backslash error hints for Windows #87
+162
−15
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
Closes #86
Windows users writing native backslash paths in
config.toml(e.g.data_dir = "C:\Users\wesmc\msgvault") get cryptic TOML parse errors because backslashes are escape characters in TOML double-quoted strings. This PR addresses the problem from two angles:1.
--homeCLI flag — Sets the home directory directly from the command line, equivalent toMSGVAULT_HOME. Config, database, tokens, attachments, and analytics all live under this directory. If aconfig.tomlexists there, it's loaded.2. Improved TOML error messages — When
config.tomlcontains backslash paths that fail to parse, the error now includes a hint:This catches both
\G-style "invalid escape" errors and\U-style "expected hexadecimal digits" errors.Changes
cmd/msgvault/cmd/root.go— Add--homepersistent flag, pass it intoconfig.Load()internal/config/config.go—Load()accepts ahomeDirparameter that overridesDefaultHome()before determining config path; detect backslash-related TOML errors and wrap with hintinternal/config/config_test.go— Tests for--home(sets HomeDir/DataDir, reads config.toml from home dir, expands tilde), tests for backslash hints (\Gand\Uvariants)CLAUDE.md— Add General Workflow, Go Development, and Git Workflow guidelinesTest plan
make testpassesmake lintpassesmsgvault.exe --home "C:\Users\wesmc\testing" init-dbuses the override directorydata_dir = "C:\Games\msgvault"shows the hintdata_dir = "C:\Users\wesmc\data"shows the hint (\Uvariant)--homedirectory is loaded (e.g.rate_limit_qpsapplies)🤖 Generated with Claude Code