-
Notifications
You must be signed in to change notification settings - Fork 261
Expand file tree
/
Copy pathProgram.cs
More file actions
37 lines (30 loc) · 1.23 KB
/
Copy pathProgram.cs
File metadata and controls
37 lines (30 loc) · 1.23 KB
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
// Copyright (c) Nate McMaster.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using McMaster.Extensions.CommandLineUtils;
namespace ResponseFileParsing
{
[Command(Name = "done", Description = "Keep track on things you've done", ResponseFileHandling = ResponseFileHandling.ParseArgsAsLineSeparated)]
[Subcommand(typeof(ListCommand))]
class Program
{
public static int Main(string[] args) => CommandLineApplication.Execute<Program>(args);
[Argument(0, "The description of what you've done")]
public string Description { get; }
[Option(CommandOptionType.MultipleValue, LongName = "tag", Description = "A tag for the item")]
public string[] Tags { get; }
private void OnExecute()
{
//...
}
}
[Command(Description = "List all done items", ResponseFileHandling = ResponseFileHandling.ParseArgsAsLineSeparated)]
class ListCommand
{
[Option(CommandOptionType.MultipleValue, LongName = "tag", Description = "Only list items with the corresponding tag(s)")]
public string[] Tags { get; }
private void OnExecute()
{
//...
}
}
}