fix(version): skip keys.json load for credential-free commands #31
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/version-no-keys-file-FJ-26"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
main()loadedKeyInfounconditionally before dispatching any subcommand.fj versionandfj completionignore credentials entirely, yet still triggeredKeyInfo::load(), which printskeys file not found, creatingto stderr on a fresh install:(
load()only emits the notice and returns a default; it does not actually write the file, so the message is doubly misleading.)Fix
Add
Command::needs_keys()returningfalseforVersion/Completionandtrueotherwise.main()now loadskeys.jsononly when the dispatched command needs it; credential-free commands getKeyInfo::default(). The single dispatch site and all credential-using commands are unchanged.Verification
XDG_DATA_HOME=$(mktemp -d) fj versionprints only the version lines, emits no notice, and creates nokeys.json.cargo build,cargo fmt --check,cargo clippy -p forgejo-cli --all-targetsall pass.#FJ-26