Giter Club home page Giter Club logo

Comments (6)

rvesse avatar rvesse commented on August 12, 2024

Most of the default option parsers are greedy and just attempt to consume the number of values required by the arity of the option without any real inspection of those values. So more specifically to your use case it doesn't try to disambiguate between the next token being a value vs it being another option.

So in your first case it sees --open and tries to parse a value for it but finds none thus you receive an error

In the second case it sees --open so grabs the next value which is --debug so your open option gets the value --debug and you don't receive an error

from airline.

rvesse avatar rvesse commented on August 12, 2024

But certainly this could be handled better, the default option parsers could check whether the next value is actually an option name and stop parsing further values if it is which should then generate the correct error in both cases

from airline.

rvesse avatar rvesse commented on August 12, 2024

So on thinking on this more I thought that the option parsers were supposed to be smart enough to check if the next token was an option and if so not treat it as a value. However it looks like one of the default parsers special cases the logic for arity = 1 to just consume the next token without that check.

So this is definitely a bug that wants fixing and I'll try to get this into the next release

from airline.

rvesse avatar rvesse commented on August 12, 2024

Changed needed:

  • ClassicGetOptParser
  • StandardOptionParser (special cases arity 1 options currently)
  • ListValueParser
  • MaybeListValueParser
  • Unit test cases for this kind of error covering all built-in option parsers

from airline.

rvesse avatar rvesse commented on August 12, 2024

Should now be fully fixed on master, will push out a new bug-fix release shortly

from airline.

rvesse avatar rvesse commented on August 12, 2024

Fixed in 2.8.2 which is now released. It may take a couple of hours for artifacts to show up on Maven Central

from airline.

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.