GithubHelp home page GithubHelp logo

Comments in args file about cmdargs HOT 5 OPEN

ndmitchell avatar ndmitchell commented on May 18, 2024
Comments in args file

from cmdargs.

Comments (5)

ndmitchell avatar ndmitchell commented on May 18, 2024

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.

from cmdargs.

alensiljak avatar alensiljak commented on May 18, 2024

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.
Ledger supports the following characters for comments: https://www.ledger-cli.org/3.0/doc/ledger3.html#Commenting-on-your-Journal

Naturally, I would not expect cmdargs to follow ledger's specs but some of those are common comment chars, like # and ;. Perhaps others, too, but I'm mostly using these two. That might be a good start?

Edit: Technically, arguments start with -- or / or a letter [A-z][a-z] or a number [0-9]? So, in theory, any other special character might a comment. But that would be too restrictive.

from cmdargs.

simonmichael avatar simonmichael commented on May 18, 2024

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 .

from cmdargs.

bsima avatar bsima commented on May 18, 2024

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.

Presumably this was just an annotated example and the # comments aren't actually part of the files

from cmdargs.

simonmichael avatar simonmichael commented on May 18, 2024

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

from cmdargs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.