commit 0df590a390388d2d5fba36d08816734abcfb62e9 parent e2e3bcb17c67d37c682556de4c067491f3d21e35 Author: Ed van Bruggen <edvb54@gmail.com> Date: Fri, 24 Oct 2014 16:23:39 -0700 Bin: Make todoium a hard link Diffstat:
bin/todoium | | | 2 | -- |
bin/todoium | | | 70 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
2 files changed, 70 insertions(+), 2 deletions(-)
diff --git a/bin/todoium b/bin/todoium @@ -1 +0,0 @@ -/home/ed/Code/Bash/todoium/todoium- \ No newline at end of file diff --git a/bin/todoium b/bin/todoium @@ -0,0 +1,70 @@ +#!/usr/bin/env bash + +# set varibles +version="v1.2" +progname="`basename $0`" + +# manually change this path if you want to use your own folder +tododir="$HOME/.todo/" + +# make sure $tododir exists +if [ ! -d $tododir ]; then + echo -ne "Warning: $tododir does not exist\nMaking it for you ... " + mkdir -p $tododir + echo "done" +fi + +todohelp() { + echo "\ +Todoium $version - GPL v3 +Usage: $progname [-holtp] [todo]\ +" +} + +todooptions() { +echo "\ +-h > show help/ info +-o > list options +-l > list todos +-t > list todos in tree form +-p > show path of todos\ +" +} + +todotree() { + local treevar="`tree $tododir`" + local treevar="`echo "$treevar" | sed -e "s/files/todos/g" -`" + local treevar="`echo "$treevar" | sed -e "s/directory/sub-folder/g" -`" + local treevar="`echo "$treevar" | sed -e "s/directories/sub-folders/g" -`" + echo "$treevar" +} + +# handle options and file creation +# if nothing is typed show the help +if [[ $1 == "" ]]; then + todohelp +# use `todoium -h` to show help +# elif [[ $1 == -h || "--help" ]]; then +elif [[ $1 == -h ]]; then + todohelp +# use 'todoium -o' to list options +# elif [[ $1 == -o || "--options" ]]; then +elif [[ $1 == -o ]]; then + todooptions +# use `todoium -l` to list your todos +# elif [[ $1 == -l || "--ls" ]]; then +elif [[ $1 == -l ]]; then + echo "`ls $tododir`" +# use `todoium -t` to list your todos in a tree +# elif [[ $1 == -t || "--tree" ]]; then +elif [[ $1 == -t ]]; then + todotree +# use `todoium -p` to echo where the todos are being stored +# elif [[ $1 == -p || "--path" ]]; then +elif [[ $1 == -p ]]; then + echo $tododir +# if no options is specified then use $1 to create file +else + touch $tododir$1 +fi +