diff options
author | EuAndreh <eu@euandre.org> | 2022-08-16 18:49:03 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2022-08-16 18:49:03 -0300 |
commit | 255e2c8fac40273a8cf001bf1f578a7f1bf18023 (patch) | |
tree | 4134f969889320cf8b5df1e9586cf503bae2fc7f | |
parent | bin/playlist: Add working version (diff) | |
download | dotfiles-255e2c8fac40273a8cf001bf1f578a7f1bf18023.tar.gz dotfiles-255e2c8fac40273a8cf001bf1f578a7f1bf18023.tar.xz |
bin/stopwatch: Add working version
-rwxr-xr-x | bin/stopwatch | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/bin/stopwatch b/bin/stopwatch new file mode 100755 index 0000000..3d5cd07 --- /dev/null +++ b/bin/stopwatch @@ -0,0 +1,65 @@ +#!/bin/sh +set -eu + + +usage() { + cat <<-'EOF' + Usage: + stopwatch + stopwatch -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -h, --help show this message + + + Run a TUI stopwatch. + + + Examples: + + Just run it: + + $ stopwatch + EOF +} + + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +while getopts 'h' flag; do + case "$flag" in + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + + +date "+%l:%M:%S%p: stopwatch started (^D to stop)" +time cat +date "+%l:%M:%S%p: stopwatch stopped" |