Print usage only for a command called wrongly (closes #41)
check / check (push) Failing after 1s
check / check (push) Failing after 1s
A failed command printed the whole usage text after its error, burying it. The root command's PersistentPreRunE now turns usage off, so an error from running the command is printed once on its own. Wrong arity, an unknown flag, a bad flag value, a missing required flag and broken flag groups still get usage: cobra checks arguments and flag values before that hook but required flags and flag groups only after it, so the hook checks those two first. Root SilenceUsage was not used: in this cobra version it hides usage for argument and flag errors too. Cobra still prints the error; Entry is unchanged. Model: opus-5-5
This commit is contained in:
@@ -25,6 +25,15 @@ Bring the repo into policy compliance in one commit:
|
||||
|
||||
# Completed Steps
|
||||
|
||||
- 2026-10-04: A failed command prints its error once, without the usage
|
||||
text after it (https://git.eeqj.de/sneak/secret/issues/41). Usage is
|
||||
still printed for a command called wrongly: wrong number of arguments,
|
||||
unknown flag, bad flag value, missing required flag, or flags that
|
||||
break a flag group (mutually exclusive, required together, one
|
||||
required). The root command's `PersistentPreRunE` turns usage off.
|
||||
Cobra checks arguments and flag values before that hook but required
|
||||
flags and flag groups only after it, so the hook checks those two
|
||||
first. Root `SilenceUsage` would have hidden usage for all of these.
|
||||
- 2026-10-04: `secret get` keeps the secret in locked memory until it
|
||||
writes it out (https://git.eeqj.de/sneak/secret/issues/37):
|
||||
`Vault.GetSecret` and `Vault.GetSecretVersion` return a
|
||||
@@ -224,8 +233,6 @@ Bring the repo into policy compliance in one commit:
|
||||
209-216); non-constant-time public key compare (vault.go:95-100).
|
||||
- High priority:
|
||||
- Secure temporary file handling and cleanup.
|
||||
- Print cobra usage only for argument errors, not internal
|
||||
failures.
|
||||
- Initialize a default unlock key at vault creation.
|
||||
- Confirmation prompts for destructive operations (keys rm, vault
|
||||
deletion).
|
||||
|
||||
Reference in New Issue
Block a user