summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJTaylor <jtaylor@classicalconversations.com>2020-12-02 16:27:55 -0500
committerJTaylor <jtaylor@classicalconversations.com>2020-12-02 16:27:55 -0500
commit99c0cba6818d3e1855ee783318b59441ca052c64 (patch)
treee40ad81eae119a16dc9cff4d890ed629767fa4b3
Initial Commit
-rw-r--r--README28
-rw-r--r--japh45
2 files changed, 73 insertions, 0 deletions
diff --git a/README b/README
new file mode 100644
index 0000000..9950cc1
--- /dev/null
+++ b/README
@@ -0,0 +1,28 @@
+# JAPH - Jackson's Awesome Project Helper
+
+## Purpose
+Japh is a command line utility to help with manuevering your files
+and building project specific commands.
+
+## Installation
+You will need to `source` the japh file from inside your
+`$HOME/.bashrc` wherever you have it installed.
+
+You also need to make sure that you have write access to the directory that
+japh is stored. For now, it simply puts all the commands it makes into a file
+called `cmds` in the same directory.
+
+## What is a command?
+These are functions that japh runs based on user input. I.E. changing
+directories, running build commands, etc.
+
+## Usage
+- Add a new project
+```
+[bashprompt] $ japh add projectname
+```
+- Switch to a project
+```
+[bashprompt] $ japh projectname
+```
+
diff --git a/japh b/japh
new file mode 100644
index 0000000..0da6022
--- /dev/null
+++ b/japh
@@ -0,0 +1,45 @@
+#!/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!"
+ ;;
+ "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"
+}