GithubHelp home page GithubHelp logo

allow passing context variables about cligen HOT 4 CLOSED

c-blake avatar c-blake commented on June 26, 2024
allow passing context variables

from cligen.

Comments (4)

c-blake avatar c-blake commented on June 26, 2024

This could probably be done more simply by just lifting the generated parser() out of the parser-dispatcher scope into the global scope and having users just call dispatchGen and then parseAndDispatchFoo() or FooFromSeq(). I don't think calling the parser without also dispatching to the wrapped proc is as easy, though I'm not sure you actually need to do that.

from cligen.

c-blake avatar c-blake commented on June 26, 2024

Also, I feel like the newly added mergeParams() may be a solution here with a little thought. I was waiting for some feedback on those interfaces before punching a new release version. You should really take a look at mergeParams().

from cligen.

c-blake avatar c-blake commented on June 26, 2024

Also, proposal 1 seems like it mostly exists as the dispatchGen parameter I called suppress. You probably just need to default the proc parameters to something instead of the Nim-default-initialization. I feel like between suppress and just using outer scope variables to pass stuff around this is not a real issue, and proposal 2 is mostly a dup of #30 which at a minimum needs its own brand new dispatchGen. So, I'm closing this.

from cligen.

c-blake avatar c-blake commented on June 26, 2024

(Also, see the new setByParse parameter which is also very close to your proposal 2, but without objects/new types).

from cligen.

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.