alias / functions for managing my time off
This commit is contained in:
parent
7d707dad27
commit
d6ea09d5a5
@ -14,6 +14,7 @@ alias goto='git go'
|
|||||||
alias master='goto master'
|
alias master='goto master'
|
||||||
alias develop='goto develop'
|
alias develop='goto develop'
|
||||||
alias gg='git config -l | grep -i' # search git config for ...
|
alias gg='git config -l | grep -i' # search git config for ...
|
||||||
|
alias ucommit='PRE_COMMIT_ALLOW_NO_CONFIG=1 git commit'
|
||||||
|
|
||||||
# Docker
|
# Docker
|
||||||
alias lzd='lazydocker'
|
alias lzd='lazydocker'
|
||||||
@ -40,7 +41,6 @@ alias me='mb'
|
|||||||
alias j='jira issue open'
|
alias j='jira issue open'
|
||||||
alias trello='3llo'
|
alias trello='3llo'
|
||||||
alias work='moro'
|
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
|
# News
|
||||||
alias hack='hacker'
|
alias hack='hacker'
|
||||||
@ -115,6 +115,7 @@ alias h='cd $HOME'
|
|||||||
alias cp='cp -i' # confirmation before overwrite #
|
alias cp='cp -i' # confirmation before overwrite #
|
||||||
alias del='rm -rf'
|
alias del='rm -rf'
|
||||||
alias mv='mv -i' # confirmation before overwrite
|
alias mv='mv -i' # confirmation before overwrite
|
||||||
|
alias mkcd='take'
|
||||||
alias rm='gomi'
|
alias rm='gomi'
|
||||||
alias df='df -H'
|
alias df='df -H'
|
||||||
alias diff='colordiff --side-by-side --ignore-space-change --width=200 --suppress-common-lines --recursive'
|
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 <proces
|
|||||||
alias root='sudo -i'
|
alias root='sudo -i'
|
||||||
alias ':q'='exit'
|
alias ':q'='exit'
|
||||||
alias current_hour='date +"%H:%M"'
|
alias current_hour='date +"%H:%M"'
|
||||||
|
alias current_time='current_hour'
|
||||||
|
|
||||||
# Linters
|
# Linters
|
||||||
alias checken="aspell check -d en"
|
alias checken="aspell check -d en"
|
||||||
|
@ -379,5 +379,36 @@ function backupgithub {
|
|||||||
}
|
}
|
||||||
# Make a directory and cd to it
|
# Make a directory and cd to it
|
||||||
function take {
|
function take {
|
||||||
mkdir -p $@ && cd ${@:$#}
|
mkdir -p $@ && cd ${@:$#}
|
||||||
|
}
|
||||||
|
function endofday {
|
||||||
|
local planned_end=$(moro status 2>&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
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user