-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathClass1.cs
35 lines (29 loc) · 950 Bytes
/
Class1.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
using System;
class Options
{
[Option('r', "read", Required = true, HelpText = "Input files to be processed.")]
public IEnumerable<string> InputFiles { get; set; }
// Omitting long name, defaults to name of property, ie "--verbose"
[Option(
Default = false,
HelpText = "Prints all messages to standard output.")]
public bool Verbose { get; set; }
[Option("stdin",
Default = false,
HelpText = "Read from stdin")]
public bool stdin { get; set; }
[Value(0, MetaName = "offset", HelpText = "File offset.")]
public long? Offset { get; set; }
}
public class Class1
{
public Class1()
{
static void Main(string[] args)
{
CommandLine.Parser.Default.ParseArguments<Options>(args)
.WithParsed<Options>(opts => RunOptionsAndReturnExitCode(opts))
.WithNotParsed<Options>((errs) => HandleParseError(errs));
}
}
}