47 lines
1.3 KiB
Bash
47 lines
1.3 KiB
Bash
# This file is meant to be sourced, not executed.
|
|
# Add the contents to your shell startup file, i.g. `.bashrc`
|
|
|
|
# Summary of workspace status
|
|
function ws_quickcheck() {
|
|
ws_list -R | awk -e '
|
|
BEGIN {
|
|
color_red="\033[31m"
|
|
color_green="\033[32m"
|
|
color_orange="\033[33m"
|
|
color_blue="\033[34m"
|
|
color_clear="\033[0m"
|
|
num_ws=0
|
|
print color_blue "--------------------------------------------------------
|
|
------------" color_clear;
|
|
print color_blue "Workspaces:" color_clear;
|
|
print color_blue "--------------------------------------------------------
|
|
------------" color_clear;
|
|
}
|
|
/^id:/ {
|
|
ws_name=$2;
|
|
}
|
|
/remaining time/ {
|
|
gsub("^.*:","",$0);
|
|
days=$1;
|
|
hours=$3
|
|
color=color_green;
|
|
remaining=days + hours / 24;
|
|
if (remaining < 7)
|
|
color=color_red;
|
|
else if(remaining < 14)
|
|
color=color_orange;
|
|
printf color "%-60s %7.2f" color_clear "\n", ws_name, remaining;
|
|
num_ws = num_ws + 1
|
|
}
|
|
END {
|
|
if (num_ws < 1)
|
|
print color_blue "(no workspaces)"
|
|
print color_blue "--------------------------------------------------------------------" color_clear;
|
|
}
|
|
'
|
|
}
|
|
|
|
# check if interactive shell
|
|
if [ -t 1 ]; then
|
|
ws_quickcheck
|
|
fi
|