-
-
Notifications
You must be signed in to change notification settings - Fork 509
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow to use a file named - as INPUT #494
Comments
You can probably use |
That works indeed. Thanks for the hint! However, the initial ambiguity described here still makes it rather difficult to script age in a way that I (or rather the user of my script) can throw any valid filename at it with me being sure that it will be indeed interpreted as a file. Now I have to manually check whether the INPUT argument is Also, the same basic issue also applies to the |
You can do |
For additional context, originally (during early development) |
I don't think you can have your cake and eat it too. Making This is even potentially a security issue. Given that |
Many other tools which accept filenames, accept those only at the end of the argument list. Then, they allow to add a separate Because of this convention, I proposed that age may understand this Interestingly, As for using the "inline marker" |
@meineerde Even if |
My understanding of the Are there tools where |
It separates flags and arguments from positional arguments. Whether the positional arguments are filenames or not is immaterial, the point is after that you stop parsing for flags and named arguments. In this case the - is not either thing and the meaning would still not change. To avoid the STDIN alias and refer to a file you would still need some escaping or path segment workaround. |
Your understanding is consistent with @meineerde 's observation:
That is, the reason |
Environment
What were you trying to do
In trying to encrypt the contents of a file named
-
. I'm giving this filename asINPUT
inWhat happened
age waits indefinitely for something to appear on STDIN instead of reading the file. Aparently, age considers the filename
Suggestions
It would probably be a good idea to honor the
--
argument before the final (optional)INPUT
argument. Anything given after--
would then be considered a filename. An input file named-
could then be specified asWith this schema, we could clearly distinguish the
-
filename from the current behavior of always forcing a read from STDIN.Alternatively, you could also specify a flag parameter to indicate that the following argument is a file and deny the specification of a final
INPUT
argument if this is given, e.g.The text was updated successfully, but these errors were encountered: