@timmy6942025/cli-timer 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +117 -0
- package/bin/stopwatch.js +5 -0
- package/bin/timer.js +5 -0
- package/package.json +24 -0
- package/settings-ui/go.mod +28 -0
- package/settings-ui/go.sum +57 -0
- package/settings-ui/main.go +699 -0
- package/settings-ui/main_test.go +86 -0
- package/src/index.js +791 -0
package/README.md
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
# CLI Timer
|
|
2
|
+
|
|
3
|
+
A simple and customizable, easy to setup/use timer and stopwatch that runs in your terminal.
|
|
4
|
+
|
|
5
|
+
## Setup
|
|
6
|
+
|
|
7
|
+
Install dependencies:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Run directly from project root:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
node bin/timer.js 5 min
|
|
17
|
+
node bin/stopwatch.js
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Or install globally from this folder:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npm link
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Then use commands:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
timer 5 min
|
|
30
|
+
stopwatch
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Usage
|
|
34
|
+
|
|
35
|
+
### Stopwatch
|
|
36
|
+
|
|
37
|
+
To use the stopwatch, simply run the following command:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
stopwatch
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Timer
|
|
44
|
+
|
|
45
|
+
To use the timer, run the following command with the desired duration:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
timer <number> <hr/hrs/min/sec> [<number> <hr/hrs/min/sec> ...]
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
For example:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
timer 5 min 2 sec
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
By default, timer and stopwatch output is centered in the terminal.
|
|
58
|
+
|
|
59
|
+
## Controls
|
|
60
|
+
|
|
61
|
+
- `p` or `Spacebar`: Pause/Resume
|
|
62
|
+
- `r`: Restart
|
|
63
|
+
- `q`, `e` or `Ctrl+C`: Exit
|
|
64
|
+
|
|
65
|
+
## Font Styles
|
|
66
|
+
|
|
67
|
+
You can view and set the ASCII font style used for the timer and stopwatch display.
|
|
68
|
+
|
|
69
|
+
To list all available fonts:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
timer style
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
This is instant and lists all figlet fonts.
|
|
76
|
+
|
|
77
|
+
To list only timer-compatible fonts (fonts that render `00:00:00` visibly):
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
timer style --compatible
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
To set your preferred font:
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
timer style <font>
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Replace `<font>` with any font name from the list shown by `timer style`.
|
|
90
|
+
|
|
91
|
+
## Settings UI
|
|
92
|
+
|
|
93
|
+
Open interactive settings UI:
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
timer settings
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
This launches a Bubble Tea based screen where you can change:
|
|
100
|
+
|
|
101
|
+
- Font
|
|
102
|
+
- Center display
|
|
103
|
+
- Show header
|
|
104
|
+
- Show controls
|
|
105
|
+
- Tick rate (50-1000 ms)
|
|
106
|
+
- Completion message
|
|
107
|
+
- Pause key / pause alt key
|
|
108
|
+
- Restart key
|
|
109
|
+
- Exit key / exit alt key
|
|
110
|
+
|
|
111
|
+
Controls in settings UI:
|
|
112
|
+
|
|
113
|
+
- `Enter`: select/toggle
|
|
114
|
+
- `Ctrl+S`: save and exit
|
|
115
|
+
- `/`: filter fonts in font picker
|
|
116
|
+
- `/`: filter keys in key picker
|
|
117
|
+
- `Esc`/`q`: back/cancel
|
package/bin/stopwatch.js
ADDED
package/bin/timer.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@timmy6942025/cli-timer",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Simple customizable terminal timer and stopwatch",
|
|
5
|
+
"main": "src/index.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"timer": "bin/timer.js",
|
|
8
|
+
"stopwatch": "bin/stopwatch.js"
|
|
9
|
+
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"test": "node --check bin/timer.js && node --check bin/stopwatch.js && node --check src/index.js",
|
|
12
|
+
"start": "node bin/timer.js 10 sec"
|
|
13
|
+
},
|
|
14
|
+
"keywords": [],
|
|
15
|
+
"author": "Timmy6942025 <timothy.thomas2011@hotmail.com>",
|
|
16
|
+
"license": "ISC",
|
|
17
|
+
"type": "commonjs",
|
|
18
|
+
"publishConfig": {
|
|
19
|
+
"access": "public"
|
|
20
|
+
},
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"figlet": "^1.10.0"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
module cli-timer-settings-ui
|
|
2
|
+
|
|
3
|
+
go 1.19
|
|
4
|
+
|
|
5
|
+
require (
|
|
6
|
+
github.com/charmbracelet/bubbles v0.14.0
|
|
7
|
+
github.com/charmbracelet/bubbletea v0.23.1
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
require (
|
|
11
|
+
github.com/atotto/clipboard v0.1.4 // indirect
|
|
12
|
+
github.com/aymanbagabas/go-osc52 v1.0.3 // indirect
|
|
13
|
+
github.com/charmbracelet/lipgloss v0.5.0 // indirect
|
|
14
|
+
github.com/containerd/console v1.0.3 // indirect
|
|
15
|
+
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
|
|
16
|
+
github.com/mattn/go-isatty v0.0.16 // indirect
|
|
17
|
+
github.com/mattn/go-localereader v0.0.1 // indirect
|
|
18
|
+
github.com/mattn/go-runewidth v0.0.14 // indirect
|
|
19
|
+
github.com/muesli/ansi v0.0.0-20211018074035-2e021307bc4b // indirect
|
|
20
|
+
github.com/muesli/cancelreader v0.2.2 // indirect
|
|
21
|
+
github.com/muesli/reflow v0.3.0 // indirect
|
|
22
|
+
github.com/muesli/termenv v0.13.0 // indirect
|
|
23
|
+
github.com/rivo/uniseg v0.2.0 // indirect
|
|
24
|
+
github.com/sahilm/fuzzy v0.1.0 // indirect
|
|
25
|
+
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab // indirect
|
|
26
|
+
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect
|
|
27
|
+
golang.org/x/text v0.3.7 // indirect
|
|
28
|
+
)
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
github.com/atotto/clipboard v0.1.4 h1:EH0zSVneZPSuFR11BlR9YppQTVDbh5+16AmcJi4g1z4=
|
|
2
|
+
github.com/atotto/clipboard v0.1.4/go.mod h1:ZY9tmq7sm5xIbd9bOK4onWV4S6X0u6GY7Vn0Yu86PYI=
|
|
3
|
+
github.com/aymanbagabas/go-osc52 v1.0.3 h1:DTwqENW7X9arYimJrPeGZcV0ln14sGMt3pHZspWD+Mg=
|
|
4
|
+
github.com/aymanbagabas/go-osc52 v1.0.3/go.mod h1:zT8H+Rk4VSabYN90pWyugflM3ZhpTZNC7cASDfUCdT4=
|
|
5
|
+
github.com/charmbracelet/bubbles v0.14.0 h1:DJfCwnARfWjZLvMglhSQzo76UZ2gucuHPy9jLWX45Og=
|
|
6
|
+
github.com/charmbracelet/bubbles v0.14.0/go.mod h1:bbeTiXwPww4M031aGi8UK2HT9RDWoiNibae+1yCMtcc=
|
|
7
|
+
github.com/charmbracelet/bubbletea v0.21.0/go.mod h1:GgmJMec61d08zXsOhqRC/AiOx4K4pmz+VIcRIm1FKr4=
|
|
8
|
+
github.com/charmbracelet/bubbletea v0.23.1 h1:CYdteX1wCiCzKNUlwm25ZHBIc1GXlYFyUIte8WPvhck=
|
|
9
|
+
github.com/charmbracelet/bubbletea v0.23.1/go.mod h1:JAfGK/3/pPKHTnAS8JIE2u9f61BjWTQY57RbT25aMXU=
|
|
10
|
+
github.com/charmbracelet/harmonica v0.2.0/go.mod h1:KSri/1RMQOZLbw7AHqgcBycp8pgJnQMYYT8QZRqZ1Ao=
|
|
11
|
+
github.com/charmbracelet/lipgloss v0.5.0 h1:lulQHuVeodSgDez+3rGiuxlPVXSnhth442DATR2/8t8=
|
|
12
|
+
github.com/charmbracelet/lipgloss v0.5.0/go.mod h1:EZLha/HbzEt7cYqdFPovlqy5FZPj0xFhg5SaqxScmgs=
|
|
13
|
+
github.com/containerd/console v1.0.3 h1:lIr7SlA5PxZyMV30bDW0MGbiOPXwc63yRuCP0ARubLw=
|
|
14
|
+
github.com/containerd/console v1.0.3/go.mod h1:7LqA/THxQ86k76b8c/EMSiaJ3h1eZkMkXar0TQ1gf3U=
|
|
15
|
+
github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=
|
|
16
|
+
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
|
|
17
|
+
github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY=
|
|
18
|
+
github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
|
|
19
|
+
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
|
|
20
|
+
github.com/mattn/go-isatty v0.0.16 h1:bq3VjFmv/sOjHtdEhmkEV4x1AJtvUvOJ2PFAZ5+peKQ=
|
|
21
|
+
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
|
|
22
|
+
github.com/mattn/go-localereader v0.0.1 h1:ygSAOl7ZXTx4RdPYinUpg6W99U8jWvWi9Ye2JC/oIi4=
|
|
23
|
+
github.com/mattn/go-localereader v0.0.1/go.mod h1:8fBrzywKY7BI3czFoHkuzRoWE9C+EiG4R1k4Cjx5p88=
|
|
24
|
+
github.com/mattn/go-runewidth v0.0.10/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk=
|
|
25
|
+
github.com/mattn/go-runewidth v0.0.12/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk=
|
|
26
|
+
github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
|
|
27
|
+
github.com/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWVwUuU=
|
|
28
|
+
github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
|
|
29
|
+
github.com/muesli/ansi v0.0.0-20211018074035-2e021307bc4b h1:1XF24mVaiu7u+CFywTdcDo2ie1pzzhwjt6RHqzpMU34=
|
|
30
|
+
github.com/muesli/ansi v0.0.0-20211018074035-2e021307bc4b/go.mod h1:fQuZ0gauxyBcmsdE3ZT4NasjaRdxmbCS0jRHsrWu3Ho=
|
|
31
|
+
github.com/muesli/cancelreader v0.2.0/go.mod h1:3XuTXfFS2VjM+HTLZY9Ak0l6eUKfijIfMUZ4EgX0QYo=
|
|
32
|
+
github.com/muesli/cancelreader v0.2.2 h1:3I4Kt4BQjOR54NavqnDogx/MIoWBFa0StPA8ELUXHmA=
|
|
33
|
+
github.com/muesli/cancelreader v0.2.2/go.mod h1:3XuTXfFS2VjM+HTLZY9Ak0l6eUKfijIfMUZ4EgX0QYo=
|
|
34
|
+
github.com/muesli/reflow v0.2.1-0.20210115123740-9e1d0d53df68/go.mod h1:Xk+z4oIWdQqJzsxyjgl3P22oYZnHdZ8FFTHAQQt5BMQ=
|
|
35
|
+
github.com/muesli/reflow v0.3.0 h1:IFsN6K9NfGtjeggFP+68I4chLZV2yIKsXJFNZ+eWh6s=
|
|
36
|
+
github.com/muesli/reflow v0.3.0/go.mod h1:pbwTDkVPibjO2kyvBQRBxTWEEGDGq0FlB1BIKtnHY/8=
|
|
37
|
+
github.com/muesli/termenv v0.11.1-0.20220204035834-5ac8409525e0/go.mod h1:Bd5NYQ7pd+SrtBSrSNoBBmXlcY8+Xj4BMJgh8qcZrvs=
|
|
38
|
+
github.com/muesli/termenv v0.11.1-0.20220212125758-44cd13922739/go.mod h1:Bd5NYQ7pd+SrtBSrSNoBBmXlcY8+Xj4BMJgh8qcZrvs=
|
|
39
|
+
github.com/muesli/termenv v0.13.0 h1:wK20DRpJdDX8b7Ek2QfhvqhRQFZ237RGRO0RQ/Iqdy0=
|
|
40
|
+
github.com/muesli/termenv v0.13.0/go.mod h1:sP1+uffeLaEYpyOTb8pLCUctGcGLnoFjSn4YJK5e2bc=
|
|
41
|
+
github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
|
42
|
+
github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY=
|
|
43
|
+
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
|
44
|
+
github.com/sahilm/fuzzy v0.1.0 h1:FzWGaw2Opqyu+794ZQ9SYifWv2EIXpwP4q8dY1kDAwI=
|
|
45
|
+
github.com/sahilm/fuzzy v0.1.0/go.mod h1:VFvziUEIMCrT6A6tw2RFIXPXXmzXbOsSHF0DOI8ZK9Y=
|
|
46
|
+
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
47
|
+
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
|
48
|
+
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
|
49
|
+
golang.org/x/sys v0.0.0-20220204135822-1c1b9b1eba6a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
|
50
|
+
golang.org/x/sys v0.0.0-20220209214540-3681064d5158/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
|
51
|
+
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab h1:2QkjZIsXupsJbJIdSjjUOgWK3aEtzyuh2mPt3l/CkeU=
|
|
52
|
+
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
|
53
|
+
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY=
|
|
54
|
+
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
|
55
|
+
golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=
|
|
56
|
+
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
|
57
|
+
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|