mirror of
https://github.com/FiloSottile/age.git
synced 2026-01-06 04:04:50 +00:00
cmd/age: improve a couple error messages
This commit is contained in:
committed by
Filippo Valsorda
parent
f3fdc33c9e
commit
53f0ebda67
@@ -126,8 +126,8 @@ func main() {
|
||||
}
|
||||
|
||||
if flag.NArg() > 1 {
|
||||
logFatalf("Error: too many arguments.\n" +
|
||||
"age accepts a single optional argument for the input file.")
|
||||
logFatalf("Error: too many arguments: %q.\n"+
|
||||
"Note that the input file must be specified after all flags.", flag.Args())
|
||||
}
|
||||
switch {
|
||||
case decryptFlag:
|
||||
|
||||
@@ -28,6 +28,10 @@ func parseRecipient(arg string) (age.Recipient, error) {
|
||||
return age.ParseX25519Recipient(arg)
|
||||
case strings.HasPrefix(arg, "ssh-"):
|
||||
return agessh.ParseRecipient(arg)
|
||||
case strings.HasPrefix(arg, "github:"):
|
||||
name := strings.TrimPrefix(arg, "github:")
|
||||
return nil, fmt.Errorf(`"github:" recipients were removed from the design.`+"\n"+
|
||||
"Instead, use recipient files like\n\n curl -O https://github.com/%s.keys\n age -R %s.keys\n\n", name, name)
|
||||
}
|
||||
|
||||
return nil, fmt.Errorf("unknown recipient type: %q", arg)
|
||||
|
||||
Reference in New Issue
Block a user