Comments (5)
After some investigation... This is technically not a bug. The current behavior is that it interprets the --foo
as the value for the ProjectDirectory
argument after having it not match the know options. Subsequently it sees the /my/project/directory
and can't match it to anything, as it's not a known option, and it already parsed the one argument. Hence fails the parse at that point. And complains about it.
I'll have to think about it more to see if there's a way to deal with this use case.
from lyra.
It might well be not a bug technically, but this behaviour is very surprising and unwelcome. In practice this happens when the user makes a typo in the option name, e.g. suppose your program synopsis is a.out [--overwrite] <file>...
. Running it as ./a.out --overrite file
really ought to give an error about an unknown option rather than creating an output file called --overrite
!
(and, of course, if you really wanted to create a file called like this, you should be able to use ./a.out -- --overrite file
)
from lyra.
@vadz indeed, it's annoying. Which is why I haven't closed this :-) Addressing this is not easy because it break backwards compat. But I'm thinking that okay in this case. Just will take more thinking to minimize the impact.
from lyra.
Would you be interested in a PR implementing this? I'd like to finally do something about it, because as much as I like Lyra's API, we can't tell our users never to make typos in their command lines (spoiler: it doesn't work).
from lyra.
@vadz if you can think of a way to do it I'd love to have a fix for it!
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
- lyra::group in "|" operator chain HOT 4
- 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.