Giter Site home page Giter Site logo

Comments (4)

alecthomas avatar alecthomas commented on August 16, 2024

I kind of agree, but the underlying reason for this is that Kingpin currently separates lexing and parsing, and -uusername lexes as -u -u -s -e -r -n -a -m -e due to short-flag combining.

I guess the parser could detect a short flag with an argument and recombine subsequent short flags, but by that stage it has no way to differentiate between the inputs -u -u and -uu. So to make this really work I would need to change this behaviour.

from kingpin.

xealot avatar xealot commented on August 16, 2024

I see. It would definitely have to understand more state within the system (to know that -u is a flag we're looking for). But then you can pretty easily get into these subtle errors where you have ambiguous parsing based on what options are available.

from kingpin.

alecthomas avatar alecthomas commented on August 16, 2024

Yes, exactly. I erred on the side of correctness initially. But, as I've used Kingpin more and more (as a user) I do find the current flag parsing a bit annoying.

Another annoying aspect of the strictness is that, as a user, I would like to be able to specify any flags at any point, rather than strictly being positioned directly after the command they are associated with. The current behaviour is quite annoying for users.

from kingpin.

alecthomas avatar alecthomas commented on August 16, 2024

This is fixed in the v2-unstable branch (gopkg.in/alecthomas/kingpin.v2-unstable), which will be the next major release of Kingpin.

from kingpin.

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.