~skiqqy/bin

285ec76c172d7c400c6f405616dcbbf77f075405 — Stephen Cochrane 2 months ago 3c0ea9d
Added my todo script

Added desc and author tag
1 files changed, 40 insertions(+), 0 deletions(-)

A todo
A todo => todo +40 -0
@@ 0,0 1,40 @@
#!/usr/bin/env bash
# Author: Skiqqy
# Simple todo tracker

main()
{
	# TODO: Consider saving dir locally for performance.
	wdir="$(find "$HOME" -regex '.*/todo' -type d 2> /dev/null | head -1)"
	[ -z "$wdir" ] && printf 'Please create a "todo" directory...\n' && return 1

	# Change work dir.
	pushd "$wdir" || return 1
		shopt -s nullglob
		case "$1" in
			compile|build)
				for f in *.md
				do
					pdf "$f"
				done
				;;
			pdf)
				select open in *.pdf
				do
					pdf "$open"
				done
				;;
			'')
				select open in *.md
				do
					$EDITOR "$open"
				done
				;;
			*)
				$EDITOR "$(basename "$1" .md).md"
				;;
		esac
	popd || return 1
}

main "$@"