Coder Social home page Coder Social logo

Comments (6)

adrianaisemberg avatar adrianaisemberg commented on June 27, 2024

True. This isn't common, however, changing this will not only break existing code (which may be acceptable in some cases, using the [Obsolete] attribute for example), it will break existing apps. Breaking existing apps affects users of the app instead of developers and this is not acceptable.
For example, if one has a script with the following lines:

myexe login -user=john -pass=foobar

Unless a developer updates the myexe code, the script will no longer work.

Thanks for the suggestion. I may consider a "CLAP2" and have this supported.

from clap.

wernight avatar wernight commented on June 27, 2024

I agree. First I forgot another benefit: The arguments end market: mycmd --foo foo -- --this-is-a-file -another-one

There are still solutions:

  1. Flag to support "-help" => "-h -e -l -p"
  2. Major version with clear backward incompatible changes (much cleaner).

from clap.

adrianaisemberg avatar adrianaisemberg commented on June 27, 2024

Can you please elaborate more on the "end market" you mentioned?
I'm not sure I understand this line:
mycmd --foo foo -- --this-is-a-file -another-one

from clap.

wernight avatar wernight commented on June 27, 2024

Everything after a " -- " will never be interpreted as a named parameter. Other than that, it has no effect.

For example both are equivalent:

mycmd --arg1 ok foo-file bar-file 
mycmd --arg1 ok -- foo-file bar-file 

It's useful when you want to make sure that file names that possibly start by "-" or "--" will not be interpreted as optional parameter values. For example this is different

mycmd --arg1 ok --arg1      # Interpreted as argument named "arg1"
mycmd --arg1 ok -- --arg1   # Interpreted as unnamed argument "--arg1"

It might not seem that useful at first but for example I use msysgit on Windows. Meaning I can call: find ... | xargs mycmd -arg1 ok -- which would be safer.

NDesk.Options supports that notation.

from clap.

alexanderfast avatar alexanderfast commented on June 27, 2024

I would also like to see this.

Or rather the full GNU style standard since I'm porting some Unix based tools to .Net and need to follow that convention. But I'm putting this here rather than creating a new issue. The minimum would be:

--long-option   # for long option names
-s              # for short option names
-abc            # for multiple short options without arguments (one character per option)
-s arg          # short option with argument
--long arg      # long option with argument

I found this project when looking for a verb based parser since I also need to be able to do something like git or mercurial:

git [verb] [verb specific options]

If you want, you could check the gnu getopt documentation although I personally find the POSIX specification a bit easier to digest.

You have some great code going on here. Maybe it would be enough to create an alternate parser with different rules. Besides, the default behavior can remain totally the same so no implementations are broken.

Would you be interested in any contributions regarding this?

from clap.

adrianaisemberg avatar adrianaisemberg commented on June 27, 2024

It was a long time since my last contribution to the project. I actually considered it "done" (only bug fixing).
Answering your question - yes, I would very much be interested in any contributions.

Thanks,
Adrian

from clap.

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.