-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGetOptions.cs
More file actions
43 lines (41 loc) · 1.61 KB
/
Copy pathGetOptions.cs
File metadata and controls
43 lines (41 loc) · 1.61 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
38
39
40
41
42
43
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using CommandLine;
using CommandLine.Text;
using System.Reflection;
namespace nyoka_Client
{
public class GetOptions
{
private static Dictionary<string, string> AllOptions = new Dictionary<string, string>();
public static void GetAllOptions ()
{
var verbTypes = (from type in Assembly.GetExecutingAssembly().GetTypes()
let testAttribute = Attribute.GetCustomAttribute(type, typeof(VerbAttribute))
where testAttribute != null
select type).ToList();
foreach(var item in verbTypes)
{
AllOptions.Add(item.CustomAttributes.ToList()
.FirstOrDefault().ConstructorArguments.ToList().FirstOrDefault().Value.ToString(),item.CustomAttributes.ToList()
.FirstOrDefault().NamedArguments.ToList().FirstOrDefault().TypedValue.ToString());
}
PrintTable table = new PrintTable {
{"Action Name", 0},
{"Action Description", 0},
};
foreach (KeyValuePair<string, string> descriptionKVPair in AllOptions)
{
string actionName = descriptionKVPair.Key;
string description = descriptionKVPair.Value;
table.addRow(
actionName,
description
);
}
Logger.logTable(table, visibleLines: false);
}
}
}