Comments (4)
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.
I just want to use lyra::group
with operator syntax, but can't find an example.
from lyra.
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.
@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)
- Non-iostream conversion.
- Modifiable bound_parser::hint()
- Surprising behavior of lyra::group, is it a bug? HOT 6
- Printing help text without ostream HOT 2
- Several options with multiple arguments HOT 1
- Negative values are not rejected for arguments associated with unsigned variables
- Please add to the README how to run unit tests HOT 1
- single_include_test.cpp fails HOT 1
- Unknown options are silently ignored and mixed with positional arguments HOT 3
- Long text wrapping in the help output
- ignore help of subcommands HOT 1
- When building with -Wshadow on GCC there are many shadowing warnings. HOT 5
- Question on how to return error in lyra::opt lambdas HOT 1
- Crash in lyra::args::args with zero arguments
- Infinite loop when non-existent argument is specified
- Wrong error message for unrecognized sub-command
- add style check to CI
- Unexpected behavior in lyra::group flags and and lyra::opt flags following the group. HOT 1
- Custom option lamba error string is dropped when nested under command parser HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lyra.