BadScript 2
Loading...
Searching...
No Matches
Options.cs
Go to the documentation of this file.
1using CommandLine;
3using System.Collections.Generic;
4
6{
7 interface IOptions
8 {
9 [Option('n', "lines",
10 Default = 5U,
11 SetName = "bylines",
12 HelpText = "HelpTextLines",
13 ResourceType = typeof(Properties.Resources))]
14 uint? Lines { get; set; }
15
16 [Option('c', "bytes",
17 SetName = "bybytes",
18 HelpText = "HelpTextBytes",
19 ResourceType = typeof(Properties.Resources))]
20 uint? Bytes { get; set; }
21
22 [Option('q', "quiet",
23 HelpText = "HelpTextQuiet",
24 ResourceType = typeof(Properties.Resources))]
25 bool Quiet { get; set; }
26
27 [Value(0, MetaName = "input file",
28 HelpText = "HelpTextFileName",
29 Required = true,
30 ResourceType = typeof(Properties.Resources))]
31 string FileName { get; set; }
32 }
33
34 [Verb("head", HelpText = "HelpTextVerbHead", ResourceType = typeof(Properties.Resources))]
36 {
37 public uint? Lines { get; set; }
38
39 public uint? Bytes { get; set; }
40
41 public bool Quiet { get; set; }
42
43 public string FileName { get; set; }
44
45 [Usage(ApplicationAlias = "ReadText.LocalizedDemo.exe")]
46 public static IEnumerable<Example> Examples
47 {
48 get
49 {
50 yield return new Example(Properties.Resources.ExamplesNormalScenario, new HeadOptions { FileName = "file.bin"});
51 yield return new Example(Properties.Resources.ExamplesSpecifyBytes, new HeadOptions { FileName = "file.bin", Bytes=100 });
52 yield return new Example(Properties.Resources.ExamplesSuppressSummary, UnParserSettings.WithGroupSwitchesOnly(), new HeadOptions { FileName = "file.bin", Quiet = true });
53 yield return new Example(Properties.Resources.ExamplesReadMoreLines, new[] { UnParserSettings.WithGroupSwitchesOnly(), UnParserSettings.WithUseEqualTokenOnly() }, new HeadOptions { FileName = "file.bin", Lines = 10 });
54 }
55 }
56 }
57
58 [Verb("tail", HelpText = "HelpTextVerbTail", ResourceType = typeof(Properties.Resources))]
60 {
61 public uint? Lines { get; set; }
62
63 public uint? Bytes { get; set; }
64
65 public bool Quiet { get; set; }
66
67 public string FileName { get; set; }
68 }
69}
Models a command line usage example.
Definition Example.cs:13
Provides settings for when formatting command line from an options instance../>.
static UnParserSettings WithGroupSwitchesOnly()
Factory method that creates an instance of CommandLine.UnParserSettings with GroupSwitches set to tru...
static IEnumerable< Example > Examples
Definition Options.cs:47