-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.go
144 lines (139 loc) · 3.8 KB
/
main.go
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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
package main
import (
"log"
"os"
"github.com/MHNightCat/tshock/util"
"github.com/urfave/cli/v2"
)
func main() {
app := &cli.App{
Flags: []cli.Flag{
&cli.StringFlag{
Name: "color",
Aliases: []string{"c"},
Usage: "Set the string color see full color in(https://github.com/MHNightCat/tmlshock?tab=readme-ov-file#color)",
},
},
Commands: []*cli.Command{
{
Name: "stopwatch",
Aliases: []string{"s"},
Usage: "Start a stopwatch",
Action: util.Stopwatch,
Flags: []cli.Flag{
&cli.StringFlag{
Name: "color",
Aliases: []string{"c"},
Usage: "Set the string color (https://github.com/MHNightCat/tmlshock?tab=readme-ov-file#color)",
},
&cli.StringFlag{
Name: "disable-hour",
Aliases: []string{"dh"},
Usage: "Disable hour(true or false)",
},
&cli.StringFlag{
Name: "colon-color",
Aliases: []string{"cc"},
Usage: "Set the colon color (https://github.com/MHNightCat/tmlshock?tab=readme-ov-file#color)",
},
},
},
{
Name: "timer",
Aliases: []string{"t"},
Usage: "Start a timer",
Action: util.Timer,
Flags: []cli.Flag{
&cli.StringFlag{
Name: "color",
Aliases: []string{"c"},
Usage: "Set the string color (https://github.com/MHNightCat/tmlshock?tab=readme-ov-file#color)",
},
&cli.StringFlag{
Name: "hour",
Aliases: []string{"hr"},
Usage: "Enter how many hours you want to count down",
},
&cli.StringFlag{
Name: "minute",
Aliases: []string{"m", "min"},
Usage: "Enter how many minunts you want to count down",
},
&cli.StringFlag{
Name: "second",
Aliases: []string{"s", "sec"},
Usage: "Enter how many seconds you want to count down",
},
&cli.StringFlag{
Name: "time",
Aliases: []string{"t"},
Usage: "Enter how many time you want to count down(format: 00:00:00)",
},
&cli.StringFlag{
Name: "disable-hour",
Aliases: []string{"dh"},
Usage: "Disable hour(true or false)",
},
&cli.StringFlag{
Name: "disable-millisecond",
Aliases: []string{"dm"},
Usage: "Disable millisecond(true or false)",
},
&cli.StringFlag{
Name: "colon-color",
Aliases: []string{"cc"},
Usage: "Set the colon color (https://github.com/MHNightCat/tmlshock?tab=readme-ov-file#color)",
},
},
},
{
Name: "clock",
Aliases: []string{"c"},
Usage: "Start a clock",
Action: util.Clock,
Flags: []cli.Flag{
&cli.StringFlag{
Name: "color",
Aliases: []string{"c"},
Usage: "Set the string color",
},
&cli.StringFlag{
Name: "second",
Aliases: []string{"s", "sec"},
Value: "true",
Usage: "Set the clock with second(true or false)",
},
&cli.StringFlag{
Name: "date",
Aliases: []string{"d"},
Value: "false",
Usage: "Set the clock with date(true or false)",
},
&cli.StringFlag{
Name: "dateformate",
Aliases: []string{"df"},
Value: "2006/02/01",
Usage: "Set the clock date formate(2006/02/01)YYYY/MM/DD",
},
&cli.StringFlag{
Name: "colon-color",
Aliases: []string{"cc"},
Usage: "Set the colon color (https://github.com/MHNightCat/tmlshock?tab=readme-ov-file#color)",
},
&cli.StringFlag{
Name: "hour-format",
Aliases: []string{"hf"},
Usage: "Set the clock 24 hr or 12hr (type 24 or 12)",
},
},
},
},
}
app.Name = "tmlshock"
app.Version = "1.2"
app.Usage = "A terminal ttl clock timer and stopwatch build by golang "
app.UsageText = "tmlshock [command] [option]"
if err := app.Run(os.Args); err != nil {
log.Fatal(err)
}
}