summaryrefslogtreecommitdiff
path: root/bashrc
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2017-01-15 13:02:54 +0200
committerLars Wirzenius <liw@liw.fi>2017-01-15 16:11:52 +0200
commitce7316136570efd9aea2dc504b072549d06a73d4 (patch)
tree4729c2938214afa0452a2b1be6495b975d7022f3 /bashrc
parenta1f167c6e4066a2023db572f091f46ca0874fa65 (diff)
downloadliw-dot-files-ce7316136570efd9aea2dc504b072549d06a73d4.tar.gz
Add taskwarrior context to PS1
Diffstat (limited to 'bashrc')
-rw-r--r--bashrc10
1 files changed, 9 insertions, 1 deletions
diff --git a/bashrc b/bashrc
index 228b97f..9f49d3b 100644
--- a/bashrc
+++ b/bashrc
@@ -63,6 +63,14 @@ QL()
esac
}
+task_context()
+{
+ local context="$(task context list | awk '$NF == "yes" { print $1 }')"
+ case "$context" in
+ ?*) echo "{{ $context }} " ;;
+ esac
+}
+
iconpart="`whoami`@`hostname`: "
titlepart="`whoami`@`hostname` -- "
prompt_command() {
@@ -79,7 +87,7 @@ prompt_command() {
fi
base="`basename "$PWD"`"
str2xterm "$base - $iconpart$PWD" "$base - $titlepart$PWD"
- PS1="\\[$(start_error)$(QL)$(normal_mode )\\]\\[$(start_bold)\\]$debian_chroot\\u@\\h$(git_prompt_part)\\[$(basename_mode)\\](\W)\\[$(start_bold)\\]\\$ \\[$(normal_mode)\\]"
+ PS1="\\[$(start_error)$(task_context)$(QL)$(start_bold)\\]\\u@\\h$(git_prompt_part)\\[$(basename_mode)\\](\W)\\[$(start_bold)\\]\\$ \\[$(normal_mode)\\]"
}
we_have_term()