ctubbsii commented on a change in pull request #254:
URL: https://github.com/apache/fluo-uno/pull/254#discussion_r477265508



##########
File path: bin/uno
##########
@@ -17,89 +17,33 @@
 
 # Start: Resolve Script Directory
 SOURCE="${BASH_SOURCE[0]}"
-while [[ -h "$SOURCE" ]]; do # resolve $SOURCE until the file is no longer a 
symlink
+# resolve $SOURCE until the file is no longer a symlink
+while [[ -h "$SOURCE" ]]; do
    bin="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
    SOURCE="$(readlink "$SOURCE")"
-   [[ $SOURCE != /* ]] && SOURCE="$bin/$SOURCE" # if $SOURCE was a relative 
symlink, we need to resolve it relative to the path where the symlink file was 
located
+   # if $SOURCE was a relative symlink, we need to resolve it relative to the
+   # path where the symlink file was located
+   [[ $SOURCE != /* ]] && SOURCE="$bin/$SOURCE"
 done
 bin="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
 # Stop: Resolve Script Directory
 
-source "$bin"/impl/load-env.sh "$1"
-source "$UNO_HOME"/bin/impl/util.sh
+uno_cmd=$1
+shift
 
-case "$1" in
-  ashell)
-    check_dirs ACCUMULO_HOME
-    "$ACCUMULO_HOME"/bin/accumulo shell -u "$ACCUMULO_USER" -p 
"$ACCUMULO_PASSWORD" "${@:2}"
-    ;;
-  zk)
-    check_dirs ZOOKEEPER_HOME 
-    "$ZOOKEEPER_HOME"/bin/zkCli.sh
-    ;;
-  env)
-    "$bin"/impl/print-env.sh "${@:2}"
-    ;;
-  fetch)
-    hash mvn 2>/dev/null || { echo >&2 "Maven must be installed & on PATH. 
Aborting."; exit 1; }
-    hash wget 2>/dev/null || { echo >&2 "wget must be installed & on PATH. 
Aborting."; exit 1; }
-    if [[ "$2" == "all" ]]; then
-      "$bin"/impl/fetch.sh fluo
-    else
-      "$bin"/impl/fetch.sh "$2" "$3"
-    fi
-    ;;
-  install)
-    "$bin"/impl/install.sh "${@:2}"
-    ;;
-  kill)
-    "$bin"/impl/kill.sh "${@:2}"
-    ;;
-  run)
-    "$bin"/impl/run.sh "${@:2}"
-    ;;
-  setup)
-    "$bin"/impl/setup.sh "${@:2}"
-    ;;
-  start)
-    "$bin"/impl/start.sh "${@:2}"
-    ;;
-  stop)
-    "$bin"/impl/stop.sh "${@:2}"
-    ;;
-  version)
-    "$bin"/impl/version.sh "${@:2}"
-    ;;
-  
-  status)
-    "$bin"/impl/status.sh "${@:2}"
-    ;;
- 
-  wipe)
-    "$bin"/impl/kill.sh
-    if [[ -d "$INSTALL" ]]; then
-      echo "removing $INSTALL"
-      rm -rf "$INSTALL"
-    fi
+# shellcheck source=bin/impl/load-env.sh
+source "$bin"/impl/load-env.sh "$uno_cmd"
+# shellcheck source=bin/impl/commands.sh
+source "$UNO_HOME"/bin/impl/commands.sh
+
+case "$uno_cmd" in
+  ashell|env|fetch|install|kill|run|setup|start|status|stop|version|wipe|zk)
+    "uno_${uno_cmd}_main" "$@"

Review comment:
       I like this, and thought about doing something like this, but didn't 
look into it to figure out the syntax. One thing I wasn't sure about was 
compatibility with Bash 3. I tried to avoid any changes I thought might not 
work on Bash 3. Since I don't have a macOS machine to test on, I chose to avoid 
this one because of uncertainty of whether it would work there.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to