-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSampleAttrApp.cs
58 lines (52 loc) · 2.36 KB
/
SampleAttrApp.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
using System;
using System.Collections.Generic;
using HzNS.Cmdr;
using HzNS.Cmdr.Base;
using HzNS.Cmdr.CmdrAttrs;
namespace SampleAttrs
{
[CmdrAppInfo(appName: "SimpleAttrs", author: "hedzr", copyright: "copyright")]
// ReSharper disable once IdentifierTypo
// ReSharper disable once ClassNeverInstantiated.Global
public class SampleAttrApp
{
// internal static int Main(string[] args) => Cmdr.Compile<Prog1>(args);
[CmdrOption(longName: "count", shortName: "c", "cnt")]
[CmdrDescriptions(description: "a counter", descriptionLong: "", examples: "")]
[CmdrRange(min: 0, max: 10)]
[CmdrRequired]
public int Count { get; }
[CmdrCommand(longName: "tags", shortName: "t")]
[CmdrGroup(@group: "")]
[CmdrDescriptions(description: "tags operations")]
public class TagsCmd
{
[CmdrCommand(longName: "mode", shortName: "m")]
[CmdrDescriptions(description: "set tags' mode", descriptionLong: "", examples: "")]
public class ModeCmd
{
[CmdrAction]
public void Execute(IBaseWorker w, IBaseOpt cmd, IEnumerable<string> remainArgs)
{
// throw new System.NotImplementedException();
Console.WriteLine(
value:
$"Hit: {cmd}, Remains: {remainArgs}. Count: {Cmdr.Instance.Store.GetAs<int>(key: "count")}");
// for (var i = 0; i < Count; i++)
// {
// // Prompt.GetPassword("Enter your password: ");
// }
}
[CmdrOption(longName: "count2", shortName: "c2", "cnt2")]
[CmdrDescriptions(description: "a counter", descriptionLong: "", examples: "", placeHolder: "COUNT")]
public int Count { get; }
[CmdrOption(longName: "ok", shortName: "ok")]
[CmdrDescriptions(description: "boolean option", descriptionLong: "", examples: "")]
public bool OK { get; }
[CmdrOption(longName: "addr", shortName: "a", "address")]
[CmdrDescriptions(description: "string option", descriptionLong: "", examples: "", placeHolder: "HOST[:PORT]")]
public string Address { get; }
}
}
}
}