Check arguments before looking for the mnemonic (closes #79)
check / check (push) Waiting to run

The key index, --words, the --to recipients and the input file of
age encrypt and age decrypt were checked only after the mnemonic had
been obtained, so a run that could not succeed still prompted for it or
ran the mnemonic command. options.Index now refuses an index above
derive.MaxIndex, which covers every command group; the mnemonic command
calls the new childmnemonic.CheckWords first; age encrypt reads its
recipients with the new agekey.Recipients, and both age commands open
their input, before the key is derived. The README says which checks
come first.

Judgement call: the -o path is still looked at after the mnemonic.

Model: opus-5-5
This commit was merged in pull request #84.
This commit is contained in:
2026-10-14 21:05:48 +02:00
parent b02f502928
commit d1ed234bc9
9 changed files with 162 additions and 62 deletions
+5
View File
@@ -52,6 +52,11 @@ func derived(cmd *cobra.Command) (string, error) {
return "", fmt.Errorf("reading the word count: %w", err)
}
err = childmnemonic.CheckWords(words)
if err != nil {
return "", err
}
parent, err := options.Mnemonic(cmd)
if err != nil {
return "", err