aboutsummaryrefslogtreecommitdiff
path: root/bin/bin/todo
blob: 378f2514c6e6a6dbb5319103e89960a0a6816505 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/bash
#
# simple todo script
# 
#  ▓▓▓▓▓▓▓▓▓▓
# ░▓ author ▓ xero <x@xero.nu>
# ░▓ code   ▓ http://code.xero.nu/todo
# ░▓ mirror ▓ http://pub.iotek.org/p/mJPHqv8
# ░▓▓▓▓▓▓▓▓▓▓
# ░░░░░░░░░░

file="~/.todo"
( [ -e "$file" ] || touch "$file" ) && [ ! -w "$file" ] && echo cannot write to $file && exit 1
if [[ -z $1 || $1 == "--help" || $1 == "-h" || $1 == "help" ]]; then
	echo "┌──────[ todo ]──[ version 0.0.1 ]─────── ─ ─"
	echo "│ usage: todo <options>"
	echo "│ author: xero harrison - http://xero.nu"
	echo "├────────────────[ options ]"───────────── ─ ─
	echo "│ -s, --show            display the todo list"
	echo "│ -a, --add <string>    add a todo item"
	echo "│ -d, --delete <number> delete a todo item"
	echo "│ -h, --help            display this screen"
	echo "└──────────────────────────────────────── ─ ─"
elif [[ $1 = '--show' || $1 = '-s' || $1 == "show" ]]; then
	while true;
	do
		clear
		echo ""
		echo "     ██                 ██"
		echo "    ░██                ░██"
		echo "   ██████  ██████   ██████  ██████"
		echo "  ░░░██  ░██░░░░██░██░░░██░██   ░██"
		echo "    ░██  ░██   ░██░██  ░██░██   ░██"
		echo "    ░░██ ░░██████ ░░██████░░██████"
		echo "     ░░   ░░░░░░   ░░░░░░  ░░░░░░"
		echo ""
		echo "     _ __ __________________ __ _"
		echo ""
		nl -b a $file
		sleep 4
	done;
elif [[ $1 = '--delete' || $1 = '-d' || $1 == "delete" ]]; then
	if [[ -z $2 ]]; then
		echo "missing option"
		echo "pass an item number to delete"
	else
		sed -e $2'd' -i $file
	fi
elif [[ $1 = '--add' || $1 = '-a' || $1 == "add" ]]; then
        if [[ -z $2 ]]; then
		echo "missing option"
		echo "pass an item to add"
	else
		echo $2 >> $file
	fi 
else
	echo "unknown option"
	echo "call 'todo --help' for more info"
fi
exit