Permalink
Browse files

conditionally define t()

if user has enabled the todo plugin, skip defining the 'one thing'
todo function t().
  • Loading branch information...
2 parents 3bde23a + dd9fb10 commit 339cfe97332a9ba08a7ef863cf49a371a9b0316a @erichs committed May 18, 2012
View
@@ -1,6 +1,6 @@
*/enabled/*
.DS_Store
-custom/*.bash
+custom/*
!custom/example.bash
.rvmrc
aliases/custom.aliases.bash
@@ -151,18 +151,20 @@ usage ()
fi
}
-t ()
-{
- about 'one thing todo'
- param 'if not set, display todo item'
- param '1: todo text'
- group 'base'
- if [[ "$*" == "" ]] ; then
- cat ~/.t
- else
- echo "$*" > ~/.t
- fi
-}
+if [ ! -e $BASH_IT/plugins/enabled/todo.plugin.bash ]; then
+# if user has installed todo plugin, skip this...
+ t ()
+ {
+ about 'one thing todo'
+ param 'if not set, display todo item'
+ param '1: todo text'
+ if [[ "$*" == "" ]] ; then
+ cat ~/.t
+ else
+ echo "$*" > ~/.t
+ fi
+ }
+fi
command_exists ()
{
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+# you may override any of the exported variables below in your .bash_profile
+
+if [ -z "$TODO_DIR" ]; then
+ export TODO_DIR=$BASH_IT/custom # store todo items in user's custom dir, ignored by git
+fi
+if [ -z "$TODOTXT_DEFAULT_ACTION" ]; then
+ export TODOTXT_DEFAULT_ACTION=ls # typing 't' by itself will list current todos
+fi
+if [ -z "$TODO_SRC_DIR" ]; then
+ export TODO_SRC_DIR=$BASH_IT/plugins/available/todo
+fi
+
+# respect ENV var set in .bash_profile, default is 't'
+alias $TODO='$TODO_SRC_DIR/todo.sh -d $TODO_SRC_DIR/todo.cfg'
+
+export PATH=$PATH:$TODO_SRC_DIR
+source $TODO_SRC_DIR/todo_completion # bash completion for todo.sh
+complete -F _todo $TODO # enable completion for 't' alias
@@ -0,0 +1,75 @@
+# === EDIT FILE LOCATIONS BELOW ===
+
+# Your todo/done/report.txt locations
+export TODO_FILE="$TODO_DIR/todo.txt"
+export DONE_FILE="$TODO_DIR/done.txt"
+export REPORT_FILE="$TODO_DIR/report.txt"
+
+# You can customize your actions directory location
+#export TODO_ACTIONS_DIR="$HOME/.todo.actions.d"
+
+# == EDIT FILE LOCATIONS ABOVE ===
+
+# === COLOR MAP ===
+
+## Text coloring and formatting is done by inserting ANSI escape codes.
+## If you have re-mapped your color codes, or use the todo.txt
+## output in another output system (like Conky), you may need to
+## over-ride by uncommenting and editing these defaults.
+## If you change any of these here, you also need to uncomment
+## the defaults in the COLORS section below. Otherwise, todo.txt
+## will still use the defaults!
+
+# export BLACK='\\033[0;30m'
+# export RED='\\033[0;31m'
+# export GREEN='\\033[0;32m'
+# export BROWN='\\033[0;33m'
+# export BLUE='\\033[0;34m'
+# export PURPLE='\\033[0;35m'
+# export CYAN='\\033[0;36m'
+# export LIGHT_GREY='\\033[0;37m'
+# export DARK_GREY='\\033[1;30m'
+# export LIGHT_RED='\\033[1;31m'
+# export LIGHT_GREEN='\\033[1;32m'
+# export YELLOW='\\033[1;33m'
+# export LIGHT_BLUE='\\033[1;34m'
+# export LIGHT_PURPLE='\\033[1;35m'
+# export LIGHT_CYAN='\\033[1;36m'
+# export WHITE='\\033[1;37m'
+# export DEFAULT='\\033[0m'
+
+# === COLORS ===
+
+## Uncomment and edit to override these defaults.
+## Reference the constants from the color map above,
+## or use $NONE to disable highlighting.
+#
+# Priorities can be any upper-case letter.
+# A,B,C are highlighted; you can add coloring for more.
+#
+# export PRI_A=$YELLOW # color for A priority
+# export PRI_B=$GREEN # color for B priority
+# export PRI_C=$LIGHT_BLUE # color for C priority
+# export PRI_D=... # define your own
+# export PRI_X=$WHITE # color unless explicitly defined
+
+# There is highlighting for tasks that have been done,
+# but haven't been archived yet.
+#
+# export COLOR_DONE=$LIGHT_GREY
+
+# === BEHAVIOR ===
+
+## customize list output
+#
+# TODOTXT_SORT_COMMAND will filter after line numbers are
+# inserted, but before colorization, and before hiding of
+# priority, context, and project.
+#
+# export TODOTXT_SORT_COMMAND='env LC_COLLATE=C sort -f -k2'
+
+# TODOTXT_FINAL_FILTER will filter list output after colorization,
+# priority hiding, context hiding, and project hiding. That is,
+# just before the list output is displayed.
+#
+# export TODOTXT_FINAL_FILTER='cat'
Oops, something went wrong.

0 comments on commit 339cfe9

Please sign in to comment.