~tardypad/dotfiles

f37f64d54c959fb7ec9796c00b8a3f7d4bbbd08c — Damien Tardy-Panis 4 months ago 3c6e39f
Only show task name if -n option is set

Consistency with ids action
3 files changed, 13 insertions(+), 7 deletions(-)

M files/docs/shell/task.scd
M files/scripts/i3blocks/i3blocks-task
M files/scripts/shell/task
M files/docs/shell/task.scd => files/docs/shell/task.scd +3 -1
@@ 12,7 12,9 @@ task [-n] *ids*

task [-l] *pick* _id_ [ _description_ ]

task [ *show* | *drop* ]
task [-n] *show*

task *drop*

# DESCRIPTION


M files/scripts/i3blocks/i3blocks-task => files/scripts/i3blocks/i3blocks-task +1 -1
@@ 5,7 5,7 @@

MODE="$( i3blocks-mode )"

TASK=$( task show 2> /dev/null )
TASK=$( task -n show 2> /dev/null )

[ -n "${TASK}" ] || exit 0


M files/scripts/shell/task => files/scripts/shell/task +9 -5
@@ 84,12 84,16 @@ task_show() {
  fi

  TASK_ID="$( cat "${CURRENT_FILE_PATH}" )"
  TASK_NAME="$(
    sed -n "s/^${TASK_ID}	\(.*\)/\1/p" "${TASKS_DIR}"/* 2> /dev/null \
      | sed 1q
  )"

  printf '%s\t%s\n' "${TASK_ID}" "${TASK_NAME}"
  if [ "${ID_WITH_NAME}" = 'true' ]; then
    TASK_NAME="$(
      sed -n "s/^${TASK_ID}	\(.*\)/\1/p" "${TASKS_DIR}"/* 2> /dev/null \
        | sed 1q
    )"
    printf '%s\t%s\n' "${TASK_ID}" "${TASK_NAME}"
  else
    printf '%s\n' "${TASK_ID}"
  fi
}

task_drop() {