Comments (7)
Furthermore, is it possible to have global options while still having a verb?
from commandline.
This is a duplicate of #490. Unfortunately, no it isn't possible. With the way verbs work in the current version (e.g. Parse<VerbA, VerbB>(args)
) I'm having a hard time thinking of a way to add a default verb and global options.
from commandline.
Thanks for the quick reply, @nemec. What about a simple IsDefault
property of the Verb
attribute. The name of the verb should also be optional in this case. As for global options, what about a special Options generic argument that inherits from a (dummy) GlobalOptions class, or something similar?
Update: Actually, quite a nice solution that already works is simply inheriting from a GlobalOptions
class!
from commandline.
I'm currently trying to come up with a workaround for this, but I can't get the NoVerbSelectedError
, nor the BadVerbSelectedError
. It just runs my (one and only) options handler instead. Using the latest beta here. Any known issue with that right now?
from commandline.
Update: it seems I have to specify at least two options types to ParseArguments
for these errors to kick in! I see why, though perhaps this should be documented.
from commandline.
You're right - it is not obvious that one generic argument is interpreted as an Options class but multiple are considered Verbs.
from commandline.
Just to clarify, is there a workaround by using GlobalOptions?
from commandline.
Related Issues (20)
- Is version 2 still beta? HOT 3
- Cannot use 2 verbs at the same time HOT 5
- Mutual exclusive option is not enforced (even when settings.MutuallyExclusive == true) HOT 3
- Has the approach to verbs in v2 changed? HOT 6
- THIS REPO GOING DEFUNCT, please submit issues/pull requests to https://github.com/commandlineparser/commandline HOT 2
- Argument value with dash not accepted when using single-dash key HOT 1
- Good, except parsing doesn't work HOT 1
- Parser state HOT 1
- Using --help HOT 1
- Inverse order of FlatternHierarchy HOT 1
- Enum Parsing Is Failing HOT 2
- Migrating from 2.3.0 to 2.4.3 HOT 3
- Please support older .NET framework versions
- Unable to parse TimeSpan given from FormatCommandLine HOT 2
- Order of options where there are list options and values HOT 1
- Group where none or all options must be provided HOT 1
- Fast HOT 1
- (Tool's);
- Tv
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 commandline.