From 050166590004fed01c39d21c8d08b16aa9fa1936 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Mon, 21 Dec 2015 03:12:04 -0500 Subject: [PATCH] bin/til -> since --- bin/til | 59 +-------------------------------------------------------- 1 file changed, 1 insertion(+), 58 deletions(-) mode change 100755 => 120000 bin/til diff --git a/bin/til b/bin/til deleted file mode 100755 index abd73c26..00000000 --- a/bin/til +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/env bash -set -e -(( $# > 0 )) || exit 1 - -# Displays the time since $1 in a human readable format (e.g. 4h 25m 55s). If given a -# file, the modified time is used. If $1 == "--", then this script acts as a converter, -# converting $2 into human a readable format, e.g. since -- 72 #=> 1m 12s - -# TODO: A help fallback -# TODO: Options parsing - -# `date` on OSX does not have the --date parameter -date=date -if [[ "$OSTYPE" == darwin* ]]; then - date=gdate -else - echo "Unsupported system" - exit 1 -fi - -# If given a file, give time since last modification -(( $# == 1 )) && [[ -f "$*" ]] && arg=reference || arg=date - -args="$*" -if [[ "$1" == "--" ]]; then - t="$2" -else - now=$(${date} +%s) - then=$(${date} --$arg="$*" +%s) - - # Show full target date - echo $(${date} --date="@$then") - - t=$(( $now - $then )) -fi - -# Bash doesn't support floating point arithmetic like zsh does, therefore: -bc < 0) print weeks, "w " - if (days > 0) print days, "d " - if (hours > 0) print hours, "h " - if (minutes > 0) print minutes, "m " - print seconds, "s" -EOF - diff --git a/bin/til b/bin/til new file mode 120000 index 00000000..8fa4be82 --- /dev/null +++ b/bin/til @@ -0,0 +1 @@ +since \ No newline at end of file