dotwryn/zsh/school
2020-03-09 14:23:38 -06:00

31 lines
466 B
Bash

#!/bin/zsh
#
# school() = School Navigation Utility
#
function school() {
cd "$SCHOOL_DIR";
[ -d "$1" ] && cd "$1";
[ -d "$2" ] && cd "$2";
return 0;
}
_school () { # autocompletion
local state
_arguments \
'1: :->class_title'\
':: :->class_child'\
;
case "$state" in
class_title)
compadd $(ls "$SCHOOL_DIR" | grep -v GITIGNORE);
;;
class_child)
compadd $(ls -F "$SCHOOL_DIR/$words[2]" | grep \/);
;;
esac
}
compdef _school school;