murtaza-u / countdown

Countdown timer built in Go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Countdown timer built in Go

countdown timer

stopwatch

Build

  1. Install go

  2. Build from source

$ git clone https://github.com/Murtaza-Udaipurwala/countdown
$ cd countdown
$ make PREFIX=~/.local install

Usage

  1. Help
$ ./countdown -h
  1. Simple stopwatch
$ ./countdown
  1. Countdown timer
$ ./countdown -s 10 # start a countdown timer for 10 seconds
$ ./countdown -m 10 # start a countdown timer for 10 minutes
$ ./countdown -h 1 -m 39 -s 18 # start a countdown timer for 1 hour, 39 minutes and 18 seconds
  1. Colors
$ ./countdown -c # enable colorful output. To be used in conjuction with any flag

Wrapper script

#!/bin/sh

hidecursor() {
    if type setterm >/dev/null 2>&1; then
        setterm --cursor off
    fi
}

showcursor() {
    if type setterm >/dev/null 2>&1; then
        setterm --cursor on
    fi
}

clear
hidecursor
trap 'showcursor' 2
countdown "$@"
showcursor

About

Countdown timer built in Go

License:GNU General Public License v3.0


Languages

Language:Go 88.7%Language:Makefile 11.3%