-
Notifications
You must be signed in to change notification settings - Fork 8
/
ArgumentParser.cs
130 lines (119 loc) · 3.38 KB
/
ArgumentParser.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
using System;
using System.Collections.Generic;
namespace huecli
{
public class ArgumentParser
{
public String[] arguments { get; set; }
public void ShowHelp()
{
Console.WriteLine("huecli 1.0 - made by bmsimons, 2018");
Console.WriteLine("Control your Hue lighting/home automation from the CLI.");
Console.WriteLine("");
Console.WriteLine("Arguments:");
Console.WriteLine("");
Console.WriteLine("Scan for UPnP-enabled hubs: huecli scan-hubs");
Console.WriteLine("Add a hub: huecli add-hub");
Console.WriteLine("Remove a hub: huecli remove-hub");
Console.WriteLine("Get available hubs: huecli get-hubs");
Console.WriteLine("Get avail. lighting for hub: huecli get-lighting hubalias");
Console.WriteLine("");
Console.WriteLine("Turn light on: huecli turn-on hubalias lightid");
Console.WriteLine("Turn light off: huecli turn-off hubalias lightid");
Console.WriteLine("Set light brightness: huecli set-brightness hubalias lightid 1-254");
Console.WriteLine("Set light temperature: huecli set-temperature hubalias lightid 154-500");
}
public bool ShouldShowHelp()
{
if (this.arguments.Length > 1)
{
return false;
}
else
{
return true;
}
}
public string GetMainAction()
{
if (this.ShouldShowHelp())
{
return null;
}
else
{
return this.arguments[1];
}
}
public bool RemoveHubCheckEnoughArguments()
{
if (this.arguments.Length == 3)
{
return true;
}
else
{
return false;
}
}
public bool AddHubCheckEnoughArguments()
{
if (this.arguments.Length == 4)
{
return true;
}
else
{
return false;
}
}
public bool GetLightingCheckEnoughArguments()
{
if (this.arguments.Length == 3)
{
return true;
}
else
{
return false;
}
}
public bool TurnOnOffCheckEnoughArguments()
{
if (this.arguments.Length == 4)
{
return true;
}
else
{
return false;
}
}
public bool SetBrightnessCheckEnoughArguments()
{
if (this.arguments.Length == 5)
{
return true;
}
else
{
return false;
}
}
public bool SetTemperatureCheckEnoughArguments()
{
if (this.arguments.Length == 5)
{
return true;
}
else
{
return false;
}
}
public ArgumentParser()
{
arguments = Environment.GetCommandLineArgs();
}
}
}