From: Mark Szymanski Date: Sun, 5 Dec 2010 22:49:45 +0000 (-0600) Subject: Added 'ref' plugin X-Git-Url: https://source.supwisdom.com/gerrit/gitweb?a=commitdiff_plain;h=ad996f0a9313ba58014840eda3d4c8b74ae47f90;p=common%2Fbash_it.git Added 'ref' plugin --- diff --git a/plugins/ref.plugin.bash b/plugins/ref.plugin.bash new file mode 100644 index 0000000..0c93d70 --- /dev/null +++ b/plugins/ref.plugin.bash @@ -0,0 +1,36 @@ +ref() { + if [ ! -d "$REF_DIR" ] + then + mkdir -p "$REF_DIR" + fi + + REF_DIR=${REF_DIR%/} + + if [ "$1" = 'ls' ] + then + if [ "$2" = '' ] + then + builtin cd "$REF_DIR" + ls -G + builtin cd - > /dev/null + return + else + builtin cd "$REF_DIR"/"$2" + ls -G + builtin cd - > /dev/null + return + fi + fi + + DIR="${1}/${2}" + + builtin cd "$REF_DIR"/"$DIR" + + if [ $(uname) = "Darwin" ] + then + open index.html + elif [ $(uname) = "Linux" ] + then + gnome-open index.html + fi +}