Skip to content

Commit 9997ec2

Browse files
authored
Create README.md
1 parent 6e4b782 commit 9997ec2

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

README.md

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# CLIHelper
2+
## Description
3+
Provides simpler management and checking of command-line arguments in an application.
4+
## How To Use
5+
```csharp
6+
using CLIHelper;
7+
8+
internal class Program
9+
{
10+
private enum MySwitch
11+
{
12+
// random switches for example
13+
b,
14+
v,
15+
x,
16+
17+
// as long as the argument matches the name, it will parse
18+
debug
19+
}
20+
21+
// attributes can be on any one method that is marked as just 'static'
22+
[Argument("arg1", CLIType.String, 1)]
23+
[Switch("arg12", typeof(MySwitch), SwitchIdentifier.Slash, 2)]
24+
[OptionalArgument("arg3", CLIType.String)]
25+
[OptionalSwitch("arg4", typeof(MySwitch), SwitchIdentifier.Hyphen)]
26+
static void Main()
27+
{
28+
var args = CLI.GetArguments(); // will return null if any parsing errors occurred, which in turn will be printed to the console
29+
30+
if (args != null)
31+
{
32+
// and now do what you need with your arguments
33+
Console.WriteLine(args["arg1"].ToString());
34+
Console.WriteLine(args["arg2"].GetEnumValue<MySwitch>());
35+
}
36+
}
37+
}
38+
```
39+
## To-Do
40+
- [ ] Check for entry method named `Main` to ensure clarity with attribute usage
41+
- [ ] Print out available arguments if none are provided
42+
- [ ] Make use of `Description` metadata in `CLIAttribute`
43+
- [ ] Replace `_` in enum value names with `-` for complex switch arguments
44+
## Download
45+
[CLIHelper.dll](https://github.com/Lexz-08/CLIHelper/releases/latest/download/CLIHelper.dll)

0 commit comments

Comments
 (0)