cmd/age: improve a couple error messages

This commit is contained in:
Filippo Valsorda
2021-03-10 11:26:45 +01:00
committed by Filippo Valsorda
parent f3fdc33c9e
commit 53f0ebda67
2 changed files with 6 additions and 2 deletions

View File

@@ -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:

View File

@@ -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)