Git Product home page Git Product logo

Comments (4)

ardan-bkennedy avatar ardan-bkennedy commented on September 28, 2024

I feel like this parse(cmd, "--bool", "arg") is behaving properly since this suggested "arg" is a value to set for the "--bool" parameter.

from conf.

sedalu avatar sedalu commented on September 28, 2024

The standard library treats parse(cmd, "--bool", "arg") and parse(cmd, "--bool=arg") differently. Only the latter attempts to do assignment to the bool flag. Whereas conf treats them identically and attempts to do assignment in both cases.

I am working on a CLI that is using conf to parse flags, so that environment variables can be captured as well. The CLI takes an optional boolean flag and a required argument. Eg. cmd some/path or cmd --bool some/path. The current behavior of conf requires invocation of the CLI as cmd --bool=true some/path, which is not as intuitive as cmd --bool some/path.

If conf is working as intended, then it would be helpful to document the behavior.

from conf.

ardan-bkennedy avatar ardan-bkennedy commented on September 28, 2024

You need the some/path option at the end. Have you looked at the code I'm using for parsing the command line? Can you see where to fix this behavior?

from conf.

sedalu avatar sedalu commented on September 28, 2024

I've opened #23 with what should be the fix. It required updating how parse flags are tracked, the order that fields are processed, and how fields are sourced for flags.

from conf.

Related Issues (19)

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.