-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathOptions.cs
63 lines (53 loc) · 1.93 KB
/
Options.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CommandLine;
using System.IO;
namespace Todo
{
class Options
{
[Option("u", "UserId", Required = false, HelpText = "UserId")]
public string username = null;
[Option("p", "password", HelpText = "password")]
public string password = null;
[OptionList("t", "tags", Separator = ',', HelpText = "Specify tags, separated by a comma")]
public IList<string> tags = null;
[Option("f", "folder", HelpText = "Specify Folder")]
public string folder = null;
[Option("c", "context", HelpText = "Specify Context")]
public string context = null;
[Option("d", "duedate", HelpText = "Specify Due Date")]
public string duedate = null;
[Option("l", "length", HelpText = "Specify Length in minutes")]
public string length = null;
[Option("s", "set", HelpText = "Specify default folder or context in the format -s Folder:Inbox")]
public string settings = null;
[ValueList(typeof(List<string>), MaximumElements = -1)]
public IList<string> task = null;
[HelpOption(HelpText = "Display this help screen.")]
public string GetUsage()
{
StringBuilder usageString = new StringBuilder();
try
{
using (TextReader sr = new StreamReader("README.md"))
{
String line;
while ((line = sr.ReadLine()) != null)
{
usageString.Append(line);
usageString.Append("\n");
}
}
}
catch (Exception e)
{
usageString.Append("The file could not be read:");
usageString.Append(e.Message);
}
return usageString.ToString();
}
}
}