Skip to content

Instantly share code, notes, and snippets.

@westurner
Last active August 17, 2024 01:56
Demo of TaskWarrior (`task`)
#!/bin/sh
# # A demo/test of taskwarrior (`task`)
#
# ## Usage
# ```sh
# ./test_demo_taskw.sh
# ```
# Note: Interactive input is required:
# - [read and] type "yes" or "y"
# - [read and] type "all" to indeed delete all tasks without further prompting
#
# ## TaskWarrior
# - Wikipedia: https://en.wikipedia.org/wiki/Taskwarrior
# - Source: https://github.com/GothenburgBitFactory/taskwarrior
# - Docs: https://taskwarrior.org/docs/
set -x
# task help
task; task list
task add "Read the source due:today priority:H project:projectA" # 1
task add Read the docs later due:tomorrow priority:M project:projectA # 2
task add project:one task abc # 3
task add project:one task def +someday depends:3 # 4
task
task 1; task 2;
task context define projectA "project:projectA or +urgent" # prompts for 'y'
task context list
task context projectA
task add task ghi # 5
task add task jkl +someday depends:3 # 6
task # lists just tasks for the current context:"project:projectA"
task next
task 1 done
task next
task 2 start
task 2 done
task context none
task delete # prompts for y/yes//all before deleting *ALL* tasks interactively
task
task context list
taskw_context_delete() {
## taskw_context_rm -- TASKRC=$HOME/.taskrc; (sed -i '/^context\..*\.read=/d' "${TASKRC}" && \
# sed -i '/^context\..*\.write=/d' "${TASKRC}")
contextname=$1
TASKRC="${TASKRC:-"$HOME/.taskrc"}"
if [ -z "${contextname}" ]; then
sed -i '/^context\..*\.read=/d' "${TASKRC}"
sed -i '/^context\..*\.write=/d' "${TASKRC}"
else
sed -i "/^context\.${contextname}\.read=/d" "${TASKRC}"
sed -i "/^context\.${contextname}\.write=/d" "${TASKRC}"
fi
}
taskw_context_delete projectA
taskw_context_delete
alias t=task
@westurner
Copy link
Author

westurner commented Aug 17, 2024

  • Copy this to a notebook and split it into cells
    • Lookup keyboard shortcut to "Split notebook cell"
      • JupyterLab,: Ctrl-minus (Ctrl+-)
    • Decide whether to use a bash jupyter kernel or just e.g. ipykernel and begin input lines with ! to run them with $SHELL instead of python;
      !bash -c "set -x; echo hello world"

Sorry, something went wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment