Posts about draft taskwarrior

Taskwarriors Context aufgebohrt

Write your post here.

task () {
  # extract the selected context by matching the regex
  # context has to be the first argument and consist only
  # of alphanumeric characters
  context=`echo $1 | egrep -o "(=)[[:alnum:]]*"`
  # check whether there was a = character
  if [ -n "$context" ]
  then
    # remove the = char
    context=`echo $context | cut -c 2-`
    # check whether a context name was given
    if [ -n "$context" ]
    then
      # name given, temporarily set this context
      task rc.context:$context "${@:2}"
    else
      # no name given, temporarily set no context
      task rc.context:none "${@:2}"
    fi
  else
    # no = char, so just call task with all arguments
    echo task "${@}"
  fi
}