From dc77ba26d1a749de93a550aaefc9b3c30bc736d0 Mon Sep 17 00:00:00 2001 From: Guillermo Ramos Date: Sun, 12 Sep 2021 21:44:42 +0200 Subject: gromo: -s overhaul --- gromo | 41 +++++++++++++++++++++++++++++------------ 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/gromo b/gromo index 63cb7c3..cadd495 100755 --- a/gromo +++ b/gromo @@ -35,8 +35,8 @@ cmd_help() { echo -e "Usage: $cmd -h \tShow this help $cmd -s \tShow status + $cmd -x \tShow status formatted for xmobar $cmd -l \tList past gromos - $cmd -x \tReturn state formatted for display in xmobar $cmd [options] \tStart task Options: @@ -57,12 +57,12 @@ cmd_list() { cmd_status() { format=$1 - state=idle - [ -f "$STATE_FILE" ] && state=$(cat "$STATE_FILE") + status=idle + [ -f "$STATE_FILE" ] && status=$(cat "$STATE_FILE") if [ "$format" = "xmobar" ]; then color=red - [ "$state" = "idle" ] && color=green + [ "$status" = "idle" ] && color=green if [ -d "$TODAY_DIR" ]; then today="" @@ -73,14 +73,31 @@ cmd_status() { [ -n "$today" ] && today=" (${today%, })" fi - echo "$state$today" + echo "$status$today" else - echo -e "state: $state\n" + echo -e "status: $status\n" if [ -d "$TODAY_DIR" ]; then # needs nullglob for task_file in "$TODAY_DIR"/*; do - sort < "$task_file" + out=$( + awk -F $FS -f - "$task_file" <