Skip to content

Strip surrounding quotes from CLI paths for Windows CMD#91

Merged
wesm merged 2 commits intomainfrom
windows-more-config-trouble
Feb 6, 2026
Merged

Strip surrounding quotes from CLI paths for Windows CMD#91
wesm merged 2 commits intomainfrom
windows-more-config-trouble

Conversation

@wesm
Copy link
Owner

@wesm wesm commented Feb 6, 2026

Summary

Fixes #86

  • Windows CMD does not strip single quotes from arguments, so --home 'C:\Users\foo' passes the literal value 'C:\Users\foo' (quotes included), producing broken paths like 'C:\Users\foo'\config.toml
  • expandPath() now strips matching surrounding single or double quotes before processing, covering --home, --config, and MSGVAULT_HOME paths

Test plan

  • TestExpandPath — new cases for single-quoted, double-quoted, mismatched, and single-char inputs
  • make lint — clean
  • make test — all pass

🤖 Generated with Claude Code

Windows CMD does not strip single quotes from arguments, so
`--home 'C:\Users\foo'` passes the literal value `'C:\Users\foo'`
(quotes included), producing broken paths like `'C:\...\'\config.toml`.

Strip matching surrounding single or double quotes in expandPath(),
which handles --home, --config, and MSGVAULT_HOME paths.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
On Unix, shells strip quotes before the process sees them, and literal
quote characters in paths are valid (if unusual). Guard the stripping
with runtime.GOOS == "windows" and mark the corresponding tests as
windowsOnly.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@wesm
Copy link
Owner Author

wesm commented Feb 6, 2026

I tested this locally and confirmed it resolves the issue when a user uses single quotes to pass the --home path

@wesm wesm merged commit 3fa1149 into main Feb 6, 2026
3 checks passed
wesm added a commit to robelkin/msgvault that referenced this pull request Feb 7, 2026
## Summary

Fixes wesm#86

- Windows CMD does not strip single quotes from arguments, so `--home
'C:\Users\foo'` passes the literal value `'C:\Users\foo'` (quotes
included), producing broken paths like `'C:\Users\foo'\config.toml`
- `expandPath()` now strips matching surrounding single or double quotes
before processing, covering `--home`, `--config`, and `MSGVAULT_HOME`
paths

## Test plan

- [x] `TestExpandPath` — new cases for single-quoted, double-quoted,
mismatched, and single-char inputs
- [x] `make lint` — clean
- [x] `make test` — all pass

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 4.6 <[email protected]>
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.

Reopen of #39 - specifying --config does not appear to work from Windows cmdline

1 participant