Fail fast for invalid RESTIC_PACK_SIZE env values (#5592)

Co-authored-by: Michael Eischer <michael.eischer@fau.de>
This commit is contained in:
gunar
2026-02-01 11:45:31 -03:00
committed by GitHub
parent 8bff5cead0
commit 7101f11133
4 changed files with 68 additions and 5 deletions
+5 -1
View File
@@ -49,6 +49,10 @@ The full documentation can be found at https://restic.readthedocs.io/ .
DisableAutoGenTag: true,
PersistentPreRunE: func(c *cobra.Command, _ []string) error {
switch c.Name() {
case "__complete", "__completeNoDesc":
return nil
}
return globalOptions.PreRun(needsPassword(c.Name()))
},
}
@@ -114,7 +118,7 @@ The full documentation can be found at https://restic.readthedocs.io/ .
// user for authentication).
func needsPassword(cmd string) bool {
switch cmd {
case "cache", "generate", "help", "options", "self-update", "version", "__complete":
case "cache", "generate", "help", "options", "self-update", "version", "__complete", "__completeNoDesc":
return false
default:
return true