Skip to content

Commit 7eb4e71

Browse files
committed
Updated README.md to represent the latest features
1 parent 53afc71 commit 7eb4e71

1 file changed

Lines changed: 42 additions & 4 deletions

File tree

README.md

Lines changed: 42 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,52 @@
22
libArgument is a .NET library for handling command-line arguments like a boss.
33
It allows you to validate arguments on-the-fly and saves you hours of work.
44

5+
If you want to test the latest features, please download the source and compile it yourself.
6+
The release may not be up-to-date.
7+
58
Features:
69

710
* The generic parsing method works with any class
8-
* Create boolean switches with the 'Switch' attribute
9-
* Create arguments with parameters using the 'Argument' attribute
10-
* Cast argument texts to int32, int64, bool, float etc. using the 'CastAs' attribute
11+
* Boolean switches with the 'Switch' attribute
12+
* Arguments with parameters using the 'Argument' attribute
13+
* Automatically casts the argument to the type of the variable
14+
* Automatically infers the argument name from the variable name if no argument name is given
15+
* Allows you to use multiple argument or switch names for one variable
16+
17+
## How does it work?
18+
It's really easy.
19+
Here's a small example:
20+
21+
```cs
22+
using Codeaddicts.libArgument;
23+
using Codeaddicts.libArgument.Attributes;
24+
25+
// A simple class with some command-line options
26+
public class MyOptions {
27+
[Argument] public string input;
28+
[Argument] public string output;
29+
[Switch] public bool verbose;
30+
}
31+
32+
public class Program {
33+
public static void Main (string[] args) {
34+
// Let the magic happen
35+
var options = ArgumentParser.Parse<MyOptions> (args);
36+
37+
// That's it! Now you can use the variables
38+
Console.WriteLine ("Input: {0}", options.input);
39+
Console.WriteLine ("Output: {0}", options.output);
40+
Console.WriteLine ("Verbose: {0}", options.verbose ? "yes" : "no");
41+
}
42+
}
43+
```
44+
45+
Call the program like that:
46+
$ MyApp.exe --input "path/to/input" --output "path/to/output" --verbose
1147

12-
And here's some code!
48+
## Can I do more advanced stuff?
49+
Sure! You can do pretty much everything :P
50+
Here's some more advanced code for you.
1351

1452
```cs
1553
using Codeaddicts.libArgument;

0 commit comments

Comments
 (0)