diff --git a/example.sh b/example.sh old mode 100755 new mode 100644 diff --git a/functions.sh b/functions.sh old mode 100755 new mode 100644 diff --git a/lib/mgmt.sh b/lib/mgmt.sh new file mode 100644 index 0000000..b42dbfd --- /dev/null +++ b/lib/mgmt.sh @@ -0,0 +1,20 @@ +# This is how you manage your sessions +# you can create a new sesssion, which will copy the +# example.sh file with a name of your choosing +# and you can edit from there + +check_for_project() { + printf 'check: %s\n' "$1" +} + +new_project() { + printf 'new: %s\n' "$1" +} + +load_project() { + printf 'load: %s\n' "$1" +} + +edit_project() { + printf 'edit: %s\n' "$1" +} diff --git a/lib/utils.sh b/lib/utils.sh new file mode 100644 index 0000000..e1545ea --- /dev/null +++ b/lib/utils.sh @@ -0,0 +1,7 @@ +print_error() { + printf 'ERROR: %s requires a project name.\n' "$1" >&2 +} + +show_help() { + printf 'Help has arrived!\n' +} diff --git a/shmux b/shmux new file mode 100755 index 0000000..e2560d8 --- /dev/null +++ b/shmux @@ -0,0 +1,61 @@ +#!/usr/bin/env sh + +. ./lib/utils.sh +. ./lib/mgmt.sh + +while :; do + case $1 in + -h | -\? | --help | help) + show_help + exit + ;; + check | check_for_project) + if [ -n "$2" ]; then + shift + check_for_project "$@" + else + print_error "$1" + exit 1 + fi + ;; + new | new_project) + if [ -n "$2" ]; then + shift + new_project "$@" + else + print_error "$1" + exit 1 + fi + ;; + load | load_project) + if [ -n "$2" ]; then + shift + load_project "$@" + else + print_error "$1" + exit 1 + fi + ;; + edit | edit_project) + if [ -n "$2" ]; then + shift + edit_project "$@" + else + print_error "$1" + exit 1 + fi + ;; + --) # End of all options. Passthru additional options to tmux? + shift + break + ;; + -?*) + printf 'ERROR: Unknown option: %s\n' "$1" >&2 + exit 1 + ;; + *) # Default case: If no more options then break out of the loop. + break ;; + esac + + shift +done