From d6ea09d5a579e688583ee6e7cd3e9e2198c70871 Mon Sep 17 00:00:00 2001 From: MorganGeek Date: Mon, 6 Jul 2020 20:03:34 +0200 Subject: [PATCH] alias / functions for managing my time off --- dot_zsh_aliases | 4 +++- dot_zsh_functions | 33 ++++++++++++++++++++++++++++++++- 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/dot_zsh_aliases b/dot_zsh_aliases index 219cd86..3d1b8ce 100644 --- a/dot_zsh_aliases +++ b/dot_zsh_aliases @@ -14,6 +14,7 @@ alias goto='git go' alias master='goto master' alias develop='goto develop' alias gg='git config -l | grep -i' # search git config for ... +alias ucommit='PRE_COMMIT_ALLOW_NO_CONFIG=1 git commit' # Docker alias lzd='lazydocker' @@ -40,7 +41,6 @@ alias me='mb' alias j='jira issue open' alias trello='3llo' alias work='moro' -alias endofday='moro status 2>&1 | \grep -Eo "Working until ([0-9:]+) will make.*" | uniq | \grep -Eo "([0-9]+:[0-9]+)"' # News alias hack='hacker' @@ -115,6 +115,7 @@ alias h='cd $HOME' alias cp='cp -i' # confirmation before overwrite # alias del='rm -rf' alias mv='mv -i' # confirmation before overwrite +alias mkcd='take' alias rm='gomi' alias df='df -H' alias diff='colordiff --side-by-side --ignore-space-change --width=200 --suppress-common-lines --recursive' @@ -168,6 +169,7 @@ alias p='ps -ef | grep -i ' # Show matching processes. Usage : p &1 | \grep -Eo "Working until ([0-9:]+) will make.*" | uniq | \grep -Eo "([0-9]+:[0-9]+)") + local max_hour="$planned_end" + local min_hour=`current_time` + if [ -z "$planned_end" ]; then + local clockout=$(moro report 2>&1 | \grep -Eo "Clock out.*([0-9:]+)" | \grep -Eo "([0-9]+:[0-9]+)") + max_hour="$clockout" + fi + if is_earlier "$min_hour" "$max_hour"; then + arrow "you should keep working, it's only $min_hour while you should work until $max_hour" + moro status + else + warning "you should stop working now because it's later than $max_hour" + moro report + fi +} +function convtimetodate { + date -j -f '%H:%M' "$1" +'%Y/%m/%d %H:%M' +} +function convtimetotimestamp { + date -j -f '%H:%M' "$1" +'%s' +} +function is_earlier { + local first=$(convtimetotimestamp "$1") + local second=$(convtimetotimestamp "$2") + if [ "$second" -gt "$first" ]; then + true + else + false + fi }