X-Git-Url: http://git.treefish.org/~alex/bitvalue.git/blobdiff_plain/c00ceacabfb02e976f37de39f45a89d51aab6fc6..af693e46fcdc99016fddd802aa4ed9663c36c038:/bitvalue diff --git a/bitvalue b/bitvalue index 617305e..7ae8888 100755 --- a/bitvalue +++ b/bitvalue @@ -2,6 +2,34 @@ CONFIG=~/.bitvaluerc +TIMESPAN="24h" + +USAGE="Usage: $(basename "$0") [-h] [-t val] +Simple bash script to visualize the value of your bitcoin investment. + +Arguments: + -h show this help text + -t set the timespan (default: $TIMESPAN)" + +while getopts ':ht:' option; do + case "$option" in + h) echo "$USAGE" + exit + ;; + t) TIMESPAN=$OPTARG + ;; + :) printf "missing argument for -%s\n" "$OPTARG" >&2 + echo "$usage" >&2 + exit 1 + ;; + \?) printf "illegal option: -%s\n" "$OPTARG" >&2 + echo "$usage" >&2 + exit 1 + ;; + esac +done +shift $((OPTIND - 1)) + if [ ! -f $CONFIG ]; then cat << EOF > $CONFIG EXCHANGE="bitstamp" @@ -14,12 +42,6 @@ fi source $CONFIG -if [ ! -z "$1" ]; then - TIMESPAN="$1" -else - TIMESPAN="30d" -fi - cat << EOF | gnuplot set terminal dumb set datafile separator ","