-
Notifications
You must be signed in to change notification settings - Fork 12
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
Comments in args file #57
Comments
Seems a reasonable thing to do - only question is what should the comment syntax be? Can you find any other similar args files that use comments? I'd prefer to copy rather than do something different. |
Hi! Thanks a lot for the feedback. I'm coming from the viewpoint of parsing the arguments for ledger-style argument files, also used in hledger. Naturally, I would not expect cmdargs to follow ledger's specs but some of those are common comment chars, like Edit: Technically, arguments start with |
Count me interested too. The recent https://www.stevegattuso.me/tech-stack/finances-budgeting.html#args has some nice examples of args files commented with #, but I'm not sure this actually works - it doesn't for me. The only docs I have found for the argument file format are at https://stackoverflow.com/questions/53995002/where-does-shell-argument-files-or-files-originate-from . |
Presumably this was just an annotated example and the |
The implementation is here: https://github.com/ndmitchell/cmdargs/blob/master/System/Console/CmdArgs/Explicit/ExpandArgsAt.hs#L7 Ignoring lines beginning with # or whitespace and # would be easy. Correctly ignoring end-of-line # comments is harder, it would be nice not to break quoted arguments containing #. Or you could ignore shell quoting rules, as I suspect java does (https://docs.oracle.com/javase/9/tools/java.htm#JSWOR-GUID-4856361B-8BFD-4964-AE84-121F5F6CF111 : Use the number sign # in the argument file to identify comments. All characters following the# are ignored until the end of line.) |
Please note that I am not too familiar with cmdargs but am a user of hledger, which uses cmdargs for parsing arguments stored in text files.
As specified in an issue there, I find that it would be very convenient to have comments in the argument files.
In case the functionality of reading the argument files is indeed part of cmdargs, would you consider ignoring lines that start with ";" (or other delimiters), for example, and leave them as comments.
This might be really useful for cases when there are multiple or confusing arguments, or just temporarily removing some of them.
Thanks!
The text was updated successfully, but these errors were encountered: