Comments (7)
Comment by alastairtree
Sunday May 31, 2015 at 12:43 GMT
I have too been looking for this feature. Anyone find/build anything?
from commandline.
Comment by gsscoder
Saturday Jun 06, 2015 at 17:15 GMT
Happy you like it... I'm recently back to work on the project.
When 2.0 swirch to beta, a lot is planned. I was thinking to something
similar too...
Maybe adding a form of post-value processing.
Regards.
Il domenica 31 maggio 2015, alastairtree [email protected] ha
scritto:
I have too been looking for this feature. Anyone find/build anything?
—
Reply to this email directly or view it on GitHub
gsscoder/commandline#122 (comment)
.
Giacomo Stelluti Scala
_Information Technology _Consultant
- GitHub*: https://github.com/gsscoder
- Twitter*: https://twitter.com/gsscoder
- Blog*: http://gsscoder.github.com/
from commandline.
Comment by TheFanatr
Saturday Oct 21, 2017 at 01:42 GMT
Any update on this?
from commandline.
I'm really waiting for this.
from commandline.
Hello
Waiting this feature, I think I will use something like the following code.
It's ok for
key1=value1
key2="value2"
but not for
key3="foo""bar"
Do you have something better to propose ?
Thanks for advance.
Sybaris
```
[Option("Dico", HelpText = "Test")]
public IEnumerable Dico { get; set; }
public Dictionary<string, string> GetDico()
{
const string KEY_VALUE1 = @"(\w+)\=(\w+)";
const string KEY_VALUE2 = @"(\w+)\=\""([.|\""]+)\""";
Dictionary<string, string> result = new Dictionary<string, string>();
foreach (var item in Dico)
{
bool matchKeyValue1 = Regex.IsMatch(item,KEY_VALUE1);
bool matchKeyValue2 = Regex.IsMatch(item, KEY_VALUE2);
if (!(matchKeyValue1 || matchKeyValue1))
throw new Exception($"Parameter {item} does not match the requirements.");
string regexElected = matchKeyValue2 ? KEY_VALUE2 : matchKeyValue1 ? KEY_VALUE1 : "";
Debug.Assert(!string.IsNullOrEmpty(regexElected));
string key = Regex.Match(item, regexElected).Groups[1].Value;
string value = Regex.Match(item, regexElected).Groups[2].Value;
result.Add(key, value);
}
return result;
}
from commandline.
Definitely a feature worth having. I'm currently using environment variables for key-value pairs. It's a bit yuck but it works for my scenario. Would be good to do it properly with this library at some stage.
from commandline.
Is there any update on this?
from commandline.
Related Issues (20)
- Looking to parse "default" value after initializing object with factory HOT 1
- Option are displayed in lowercase in help HOT 2
- Trying to use custom type for options: "is defined with a bad format." HOT 1
- Does Command Line Parser affect the program execution? HOT 1
- Parallel.ForEachAsync not working in Debug mode within the WithParsed method HOT 2
- Increase the number of verbs supported HOT 2
- bool value is not support HOT 3
- Change "Command Line Grammar" wiki page
- Backslash parsing problem in argument. HOT 1
- `VerbAttribute` has unnecessary breaking changes between 2.8.0 and 2.9.1 HOT 1
- Bad format doesn't contain a lot of info HOT 2
- Multi instance setting ignored when default verb is parsed.
- How to get help information as a variable? HOT 1
- Detecting switches HOT 1
- Handling the CS8618 warning (Non-nullable property) HOT 1
- Is the package being maintained? HOT 1
- VerbAttribute violates CS3016 code inspection
- Code crashes without any concrete error and no help documents
- Praser saying "Option parameter was provided without an option." need help
- Help to create Options 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 commandline.