Coder Social home page Coder Social logo

lyra::group in "|" operator chain about lyra HOT 4 CLOSED

bfgroup avatar bfgroup commented on May 12, 2024
lyra::group in "|" operator chain

from lyra.

Comments (4)

vadz avatar vadz commented on May 12, 2024

This example seems to create an empty group, not containing anything, so it doesn't really work even if it compiles. But I don't see how can you use lyra::group() with the operator syntax neither, which is a pity because I prefer the more compact syntax, but it appears to be incompatible with something as simple as the standard --version option, as specifying it must make all the other options optional, which can only be achieved by using a group in Lyra, AFAICS.

I'd really like to know how to implement --version handling with Lyra in a simple way.

from lyra.

elegracer avatar elegracer commented on May 12, 2024

I just want to use lyra::group with operator syntax, but can't find an example.

from lyra.

vadz avatar vadz commented on May 12, 2024

Yes, me too. I don't think it's possible right now because operator| only works with cli objects that are not convertible to arguments (it uses non-public inheritance) and so can't be consumed by a group. But I could be wrong...

from lyra.

grafikrobot avatar grafikrobot commented on May 12, 2024

@elegracer like @vadz said you are creating an empty group. I think you meant to make --id and --grade part of the group. I created a test case for your example (and others) here https://github.com/bfgroup/Lyra/blob/develop/tests/issue_65_run_test.cpp#L128 that shows things working.

@vadz there are a couple of ways to implement a --version type argument. The most obvious one is to make it work like the help which uses a short circuit to ignore anything else https://github.com/bfgroup/Lyra/blob/develop/include/lyra/help.hpp#L32. Also I made a related fix on another issue which I think also resolved what you experienced with the op| and group. I added test cases to check for that to the test for this issue https://github.com/bfgroup/Lyra/blob/develop/tests/issue_65_run_test.cpp#L78.

from lyra.

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.