diff options
| author | Douglas Rumbaugh <doug@douglasrumbaugh.com> | 2021-12-20 18:55:15 -0500 |
|---|---|---|
| committer | Douglas Rumbaugh <doug@douglasrumbaugh.com> | 2021-12-20 18:56:45 -0500 |
| commit | 39e386e9dcbe8b5ef762af10354be6d19110776c (patch) | |
| tree | 8b6ff4b7f8474cd53b27dddf9529b810a92812a0 | |
| parent | 1f96ab1edf18b54578db177921f9d096c913e343 (diff) | |
| download | sh-ves-39e386e9dcbe8b5ef762af10354be6d19110776c.tar.gz | |
ves.sh: Turned ves into a function
| -rw-r--r-- | Makefile | 4 | ||||
| -rw-r--r-- | ves.sh | 113 |
2 files changed, 61 insertions, 56 deletions
@@ -12,6 +12,10 @@ endif BIN_DIR=$(HOME)/.local/bin +# TODO: ves needs to be installed as a function in the user's +# shell. This will require making updates to their configuration +# file as part of the install process, which will require a bit +# of extra work. install: - test -d $(DATA_DIR)/ves/bin || mkdir -p $(DATA_DIR)/ves/bin - test -d $(DATA_DIR)/ves/lib || mkdir -p $(DATA_DIR)/ves/lib @@ -1,59 +1,60 @@ #!/bin/sh +ves() { + if [ -z "$VES_SCRIPTS_DIR" ]; then + VES_BIN="$HOME/.local/bin/ves_scripts" + else + VES_BIN="$VES_SCRIPTS_DIR" + fi -if [ -z "$VES_SCRIPTS_DIR" ]; then - VES_BIN="$HOME/.local/bin/ves_scripts" -else - VES_BIN="$VES_SCRIPTS_DIR" -fi - -# extract the appropriate command -case $1 in - create) - shift - $VES_BIN/ves-create.sh $@ - break - ;; - delete) - shift - $VES_BIN/ves-delete.sh $@ - break - ;; - var-add) - shift - $VES_BIN/ves-addvar.sh $@ - break - ;; - var-rm) - shift - $VES_BIN/ves-rmvar.sh $@ - break - ;; - export) - shift - $VES_BIN/ves-export.sh $@ - break - ;; - list) - shift - $VES_BIN/ves-list.sh $@ - break - ;; - activate) - shift - $VES_BIN/ves-activate.sh $@ - break - ;; - deactivate) - shift - $VES_BIN/ves-deactivate.sh $@ - break - ;; - prompt) - shift - $VES_BIN/ves-prompt.sh $@ - break - ;; - *) - printf "ERROR: Invalid command [%s]\n" $1 > /dev/stderr -esac + # extract the appropriate command + case $1 in + create) + shift + . $VES_BIN/ves-create.sh $@ + break + ;; + delete) + shift + . $VES_BIN/ves-delete.sh $@ + break + ;; + var-add) + shift + . $VES_BIN/ves-addvar.sh $@ + break + ;; + var-rm) + shift + . $VES_BIN/ves-rmvar.sh $@ + break + ;; + export) + shift + . $VES_BIN/ves-export.sh $@ + break + ;; + list) + shift + . $VES_BIN/ves-list.sh $@ + break + ;; + activate) + shift + . $VES_BIN/ves-activate.sh $@ + break + ;; + deactivate) + shift + . $VES_BIN/ves-deactivate.sh $@ + break + ;; + prompt) + shift + . $VES_BIN/ves-prompt.sh $@ + break + ;; + *) + printf "ERROR: Invalid command [%s]\n" $1 > /dev/stderr + esac +} |