#!/bin/bash # Jackson's Awesome Project Helper # Jackson Taylor - 12/2/2020 # See README for more information JAPH_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" CMD_FILE="$JAPH_DIR/cmds" function japh() { case $1 in "add") dir=$(pwd) printf "function cd_$2() { cd \"$dir\"; }\n" >> $JAPH_DIR/cmds echo "project added!" ;; "-a") # Show the currently added commands cat $CMD_FILE ;; "help" | "-h") japh_usage ;; *) if [ ! -z $1 ]; then source $JAPH_DIR/cmds type cd_$1 &> /dev/null status=$? if [ $status -eq 0 ]; then cd_$1 else echo "Command was not found!" japh_usage fi else japh_usage fi ;; esac } function japh_usage() { printf "JAPH - Jackson's Awesome Project Helper\n" printf "japh add \$projectName - Add current directory to japh's list as \$projectName\n" printf "japh \$projectName - cd to project directory\n" }