board (912B)
1 #!/bin/sh 2 3 board() { 4 #dir="$HOME/iawriter/" 5 dir="." 6 format="-O" 7 8 if [ $# -gt 0 ]; then 9 if [ "$1" = "-h" ]; then 10 echo "board: Open a progress board of markdown files." 11 echo "usage: $0 [options] [target_directory]" 12 echo "options:" 13 printf "\\t-h show this info\n" 14 printf "\\t-s open view as horizontal splits (if $EDITOR is vim)\n" 15 printf "By default the {todo,progress,done}.md files are opened in " 16 printf "the current directory. Optionally, a different directory " 17 printf "is used if a 'target_directory' is specified.\n" 18 exit 0 19 20 elif [ "$1" = "-h" ]; then 21 format="-o" 22 if [ $# -gt 1 ]; then 23 dir="$2" 24 fi 25 else 26 dir="$1" 27 fi 28 fi 29 30 if [ "$EDITOR" = "vim" ]; then 31 vim +'windo normal G' -c "windo set tw=1000" "$format" \ 32 "$dir"/todo.md "$dir"/progress.md "$dir"/done.md 33 else 34 $EDITOR "$dir"/done.md "$dir"/progress.md "$dir"/todo.md 35 fi 36 } 37 38 board "$@"