When running init on an already-initialized store, it immediately reports that the store is already initialized, but the command doesn't fail until after the user selects the GPG key to use.
Steps To Reproduce
Initialize the root password store with gopass init
Run gopass init a second time
Expected behavior
The command should detect an already-initialized store and fail immediately. It should not prompt the user for additional information that will never be used.
Additional context
The second gopass init command produces the following output:
Initializing a new password store:
✗ Store is already initialized!
- Searching for usable private keys...
! Hint: Use 'gopass init <subkey> to use subkeys!'
? Please select a private key for encrypting secrets:
[...]
Please enter the number of a key (0-2, [q]uit) (q to abort) [0]: 2
Error: Failed to initialize store: failed to init store "" at "~/.local/share/gopass/stores/root": failed to initialize new sub store: found already initialized store at "~/.local/share/gopass/stores/root".
You can add secondary stores with 'gopass init --path <path to secondary store> --store <mount name>'
`
Summary
When running
init
on an already-initialized store, it immediately reports that the store is already initialized, but the command doesn't fail until after the user selects the GPG key to use.Steps To Reproduce
gopass init
gopass init
a second timeExpected behavior
The command should detect an already-initialized store and fail immediately. It should not prompt the user for additional information that will never be used.
Additional context
The second
gopass init
command produces the following output: