You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create private static properties in the class containing your ```Main()``` and mark them with the ```Argument``` attribute, assigning short and long names. Invoke
24
+
the ```Arguments.Populate()``` method within ```Main()```, then implement the rest of your logic.
25
+
26
+
The library will populate your properties with the values
27
+
specified in the command line arguments.
28
+
29
+
```c#
30
+
internalclassProgram
31
+
{
32
+
[Argument('b', "boolean")]
33
+
privatestaticboolBool { get; set; }
34
+
35
+
[Argument('f', "float")]
36
+
privatestaticdoubleDouble { get; set; }
37
+
38
+
[Argument('i', "integer")]
39
+
privatestaticintInt { get; set; }
40
+
41
+
[Argument('s', "string")]
42
+
privatestaticstringString { get; set; }
43
+
44
+
privatestaticvoidMain(string[] args)
45
+
{
46
+
Arguments.Populate();
47
+
48
+
Console.WriteLine("String: "+String);
49
+
Console.WriteLine("Bool: "+Bool);
50
+
Console.WriteLine("Int: "+Int);
51
+
Console.WriteLine("Double: "+Double);
52
+
}
53
+
}
54
+
```
55
+
14
56
## Grammar
15
57
16
58
The grammar supported by this library is designed to follow the guidelines set forth in the publication
@@ -19,7 +61,7 @@ located [here](http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap1
19
61
20
62
Each argument is treated as a key-value pair, regardless of whether a value is present. The general format is as follows:
21
63
22
-
```[-|--|/]argument-name[=|:| ]["|']value['|"]```
64
+
```<-|--|/>argument-name<=|:| >["|']value['|"]```
23
65
24
66
The key-value pair may begin with a single dash, a pair of dashes (double dash), or a forward slash. Single and double dashes indicate the use of short
25
67
or long names, respectively, which are covered below. The forward slash may represent either, but does not allow for the grouping of parameterless
0 commit comments