ttimer is a simple timer that counts down time left in a terminal window. If run on Mac, Windows, or desktop Linux, it will send silent system notifications at 90% and 100% completion.
brew install drgrib/tap/ttimer
To get the latest version after installing with brew, use:
brew upgrade ttimer
go install github.com/drgrib/ttimer@latest
To make it accessible on the command line as ttimer, ensure you've added $GOPATH/bin to your $PATH.
Lets say you want a timer for 3 minutes. Simply enter:
ttimer 3
This will start a timer count down like so:
== 3m Timer ==
2m55s
Or if you want a very specific duration, you can specify it using:
ttimer 3h2m5s
Or if you want a very short time:
ttimer 30s
Let's say you need to leave for the bus by 8:12 am, which is coming up in the next hour. You could simply enter:
ttimer 812
And ttimer will automatically infer the next occurrence of 8:12, which is am:
== 812a Timer ==
23m29s
If you want to force it to set a timer for 8:12 pm, you could use:
ttimer 812p
Resulting in something like:
== 812p Timer ==
12h22m25s
If you want a timer for 3:00 pm, you could simply enter:
ttimer 3p
All end time timers are set to align to zero seconds on the minute so they will change over to new minutes with the system clock.
- Integers less than
100and floats will be interpreted as minutes. - Strings fitting a call to
time.ParseDurationwill be interpreted as that duration. E.g.1m30sor2h. - Strings ending in
a,p,am, orpmwill be interpreted as times. E.g.1por930a. - Integers greater than or equal to
100will be interpreted as times. E.g.242will be interpreted as the next occurrence of2:42and set toamorpm, whichever is soonest.
To exit the timer at any time, simply press q.
To make the timer automatically exit after finishing, pass the -q argument like this
ttimer -q 30s
