Comments (10)
Hi, thanks for reporting.
You're working on development or stable branch? For the name of the method I argue the first...
from commandline.
I'm working on the master branch. I've sent you a PR so you can see what I did to get the desired behavior (but I see now that ArgumentParser.cs is gutted in the dev branch so it's probably irrelevant).
from commandline.
@turch, no it's not irrelevant... Often between me and contrib we use PR to show up problems.
Could be my fault, in the issues there's an announcement
called "Coordinate PR to development branch" that I should rename to "Coordinate PR".
In this time main kernel is under heavy refactoring and I'm not able to accept PR...
I'll clarify it in the informative issue.
Anyway thank for using the library and for your interest in the project! :)
Please accept this state of art for the moment and please take as good this reply for other issue.
Thanks again,
Giacomo Stelluti Scala
P.S.: all work done is not lost and will evaluated and eventually integrated in 2.0, along with credits.
from commandline.
New 2.0 pre-rel automatically handle collection targets using always [Option]
attribute. I'm going to check if there's unit test coverage for this, if not I'll add one.
from commandline.
Sorry, please not take into account last post...
This feature lacks in 2.0 pre-rel, it will be implemented ASAP.
So I mark the issue as enhancement in respect of master branch.
from commandline.
I'm experimenting on issue68 branch (derived from master
and still work in progress) how to implement previous OptionList
adding only a Separator
property to the model (both Option and Value attrs).
When targeting IEnumerable<T>
two things could happens:
- the single argument is expanded after being divided by Separator and everything proceeds as with normal sequence parsing
- or we can treat it as particular conversion in which the value is processed by
string.Split(...)
Some reasoning is necessary... I want to keep the core of 2.0 as compact as possible.
from commandline.
In the master branch, it seems like there is no way to explicitly say you want to parse multiple parameters, right? That knowledge is gained from a combination of OptionAttribute
+ IEnumerable<T>
type.
So let's say, without any additional configuration would you allow this as a valid input?
[Option('i')]
public IEnumerable<int> Integers { get; set; }
$ example.exe -i 1 2 3 4
If so, it may be more "clean" to do your first suggestion of splitting -i 1:2:3:4
into a sequence of arguments -i 1 2 3 4
and continuing with normal parsing. However, adding a separator might create duplicate functionality (with the separator vs. with spaces) and allow some weird situations:
$ example.exe -i 1:2:3 4 5 6:7 8
I'd be inclined to say that whitespace is always the separator and if you want something custom you could apply a custom TypeConverter to the property (which will allow the user to perform any custom conversion)
from commandline.
@nemec, yes you'll right. As now is impossible in 2.0...! I've started something (still not completed -> in a branche named issue68.
- DONE: I've added a Separator property to public attributes and specification model types.
- TODO: "cheat" the parser when Separator has a value != "" (or it can be redefined
Maybe<string>
just in the model), split the arg and explode it in the token sequence.
Thanks for comments.
from commandline.
I'm about to merge issue68 -> master... I've temporary added Separator to both Option and Value, but I think that only Option should have it (so it's consistent with latest stable).
I'll revert back this thing for Value attr, add few test and merge to master.
cc/ @nemec @mizipzor @gimmemoore
from commandline.
[Option('i', Separator=":")]
public IEnumerable<int> Integers { get; set; }
This is now possible... Is the old OptionList
. I close the issue. I'm wondering if it's better define the Separator as System.Char
.
from commandline.
Related Issues (20)
- Support for default verb? HOT 7
- 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.