Update default output path in README.md#210
Conversation
Previously, the README seemed to suggest `all-smi` would write to `./all-smi-record.ndjson.zst` in the current directory. Fixing the readme here to clarify it actually writes to `~/.cache/all-smi` by default.
|
|
|
Thanks @victorhooi , and your instinct is right on both counts: the README was wrong, and the default is more confusing than it should be. I traced it through the code: Your correction is accurate. The effective default really is Why it feels confusing- the default is surfaced inconsistently across three places:
So this PR fixes the README, but Cross-platform caveat: the Because of that, we'd like to fix this a little more thoroughly: align One process note: we can't merge this PR as-is because the CLA check is still unsigned. We'll track the fuller fix as a separate issue/PR. Thank you again for catching this and for the clear write-up- the "I find this default a bit confusing" remark is exactly what prompted the deeper look. 🙏 |
|
Tracking the fuller fix in #223 : it covers the doc alignment ( |
* fix: resolve record default output path consistently (#223) `all-smi record`'s default output path was advertised inconsistently across `all-smi record --help`, the `from_args_with_settings` doc comment, and the README; behind the scenes the default was resolved by string-matching the operator's `-o` value against the magic basename `all-smi-record.ndjson.zst`. As a side effect of that string-sentinel guard, passing `-o all-smi-record.ndjson.zst` explicitly was silently redirected under `record.output_dir` (the cache dir) instead of being written verbatim to the current directory — a quiet behaviour change no operator would expect from a flag they passed explicitly. Scope A of the fix (this commit): - Make `RecordArgs::output` an `Option<PathBuf>` and drop clap's `default_value`. Resolution now happens in `from_args_with_settings`: `Some(p)` is honored verbatim, `None` falls back to `<output_dir>/<DEFAULT_BASENAME>` (or just `<DEFAULT_BASENAME>` when no config is loaded). The brittle basename comparison is gone. - Introduce a single shared `pub const DEFAULT_BASENAME: &str = "all-smi-record.ndjson.zst"` in `record/mod.rs`, dedupe-ing the literal that was previously inlined in both `cli.rs` and the resolver. - Align all three doc surfaces (the clap `long_help` on `--output`, the `from_args_with_settings` doc block, and the README record-options table) on the same default-resolution story. - Add four unit tests for the resolver: no `-o` + no config, no `-o` + config `output_dir`, explicit `-o` equal to the default basename (regression guard for the silent-redirect bug), and explicit `-o` absolute path with and without config. Scope B from the issue (deriving the cache base from `dirs::cache_dir()` so Windows / macOS land in their platform-correct cache directories) is intentionally deferred per the issue's own recommendation — it changes where existing files live and warrants a separate decision and migration note. Folds in the README correction originally proposed in #210 by @victorhooi, with credit; that PR could not be merged directly due to an unsigned CLA. * test: add tilde-expansion coverage for record output resolver When `record.output_dir` is a tilde-prefixed path (e.g. `~/my-records`), the resolver calls `expand_tilde` before joining `DEFAULT_BASENAME`. The existing `resolve_output_no_cli_with_config_dir` test used an absolute path, so that branch was untouched. The new `resolve_output_no_cli_with_tilde_config_dir` test exercises the expansion call directly and derives its expected value from the same `expand_tilde` helper the resolver uses, making it portable across environments where `$HOME` may or may not be set.
Previously, the README seemed to suggest
all-smiwould write to./all-smi-record.ndjson.zstin the current directory.Fixing the readme here to clarify it actually writes to
~/.cache/all-smiby default.(To be honest, I find that default a bit confusing - but I'm assuming there's some precedent here?)