FiloSottile / age

A simple, modern and secure encryption tool (and Go library) with small explicit keys, no config options, and UNIX-style composability.
https://age-encryption.org
BSD 3-Clause "New" or "Revised" License
16.83k stars 492 forks source link

Decryption arguments unexpectedly order dependent #160

Closed igloo22225 closed 2 years ago

igloo22225 commented 3 years ago

Environment

What were you trying to do

Decrypt was a file

What happened

Decryption arguments unexpectedly order dependent

 igloo@defiant  ~/workf  ../git/age/age -d IMG_20201201_205126.jpg.age -i ../git/age/somekey > img.jpg
Error: too many arguments.
age accepts a single optional argument for the input file.
[ Did age not do what you expected? Could an error be more useful? Tell us: https://filippo.io/age/report ]
 ✘ igloo@defiant  ~/workf  ../git/age/age -d -i ../git/age/somekey IMG_20201201_205126.jpg.age > img.jpg 
benjojo commented 3 years ago

@str4d points out this works in rage

FiloSottile commented 3 years ago

We probably don't want to pull in an external flag parsing dependency, but we should detect the issue (by noticing there is a second argument that starts with -) and print a suggested fixed command.