Skip to content

Commit 64899ee

Browse files
committed
Merge branch 'master' into develop
2 parents 96a1ee3 + 032e4c7 commit 64899ee

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

README.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,43 @@ You can utilize the parser library in several ways:
4646
1. Create a class to define valid options, and to receive the parsed options.
4747
2. Call ParseArguments with the args string array.
4848

49+
C# Quick Start:
50+
51+
```csharp
52+
using System;
53+
using CommandLine;
54+
55+
namespace QuickStart
56+
{
57+
class Program
58+
{
59+
public class Options
60+
{
61+
[Option('v', "verbose", Required = false, HelpText = "Set output to verbose messages.")]
62+
public bool Verbose { get; set; }
63+
}
64+
65+
static void Main(string[] args)
66+
{
67+
Parser.Default.ParseArguments<Options>(args)
68+
.WithParsed<Options>(o =>
69+
{
70+
if (o.Verbose)
71+
{
72+
Console.WriteLine($"Verbose output has been enabled. Current Arguments: -v {o.Verbose}");
73+
Console.WriteLine("Quick Start Example! App is in Verbose mode so verbose messages will be shown!");
74+
}
75+
else
76+
{
77+
Console.WriteLine($"Current Arguments: -v {o.Verbose}");
78+
Console.WriteLine("Quick Start Example!");
79+
}
80+
});
81+
}
82+
}
83+
}
84+
```
85+
4986
C# Examples:
5087

5188
```csharp

0 commit comments

Comments
 (0)