From ea2d9fd4edc625798729fcc74d554d9f0923ca4a Mon Sep 17 00:00:00 2001 From: Thomas Vachuska Date: Wed, 23 Sep 2015 13:13:25 -0700 Subject: [PATCH] ONOS-2854 Fixed a few bugs and made tiny improvements to shell scripts. Change-Id: I624dc05300944dbc8b1f408bf725c49ff96f68c2 --- tools/dev/bash_profile | 62 ++++++++++++++++++------------------- tools/test/bin/ogroup-opts | 2 +- tools/test/bin/onos-service | 1 - 3 files changed, 32 insertions(+), 33 deletions(-) diff --git a/tools/dev/bash_profile b/tools/dev/bash_profile index 5e161ccd9b..f39c2ce1a5 100644 --- a/tools/dev/bash_profile +++ b/tools/dev/bash_profile @@ -148,41 +148,41 @@ function nuke { spy "$@" | cut -c7-11 | xargs kill } -# Edit a cell file by providing a cell name. Opens the cell file in $EDITOR. -function vicell() { - local apply=false - local create=false - local cdf="" - local cpath="${ONOS_ROOT}/tools/test/cells/" +# Edit a cell file by providing a cell name; opens the cell file in $EDITOR. +function vicell { + local apply=false + local create=false + local cdf="" + local cpath="${ONOS_ROOT}/tools/test/cells/" - if [ -z "$1" ] || [ "$1" = "-h" ] ; then - printf "usage: vicell [file] [options]\n\noptions:\n" - printf "\t-a: apply the cell after editing\n" - printf "\t-e: [editor] set EDITOR to [editor] (default *vi*)\n" - printf "\t-c: create cell file if none exist\n\n" - return 1 - fi + if [ -z "$1" ] || [ "$1" = "-h" ] ; then + printf "usage: vicell [file] [options]\n\noptions:\n" + printf "\t-a: apply the cell after editing\n" + printf "\t-e: [editor] set EDITOR to [editor] (default *vi*)\n" + printf "\t-c: create cell file if none exist\n\n" + return 1 + fi - while [ $# -gt 0 ]; do - case "$1" in - -a) apply=true ;; - -e) EDITOR=$2; shift ;; - -c) create=true ;; - *) cdf="$1" ;; - esac - shift - done + while [ $# -gt 0 ]; do + case "$1" in + -a) apply=true ;; + -e) EDITOR=$2; shift ;; + -c) create=true ;; + *) cdf="$1" ;; + esac + shift + done - if [ ! -e "${cpath}${cdf}" ] && [ "$create" = "false" ]; then - printf "${cdf} : no such cell\n" && return 1 - fi + if [ ! -e "${cpath}${cdf}" ] && [ "$create" = "false" ]; then + printf "${cdf} : no such cell\n" && return 1 + fi - if [ -z "${EDITOR}" ] || [ -x "$(which ${EDITOR})" ]; then - unset EDITOR && vi ${cpath}${cdf} - else - $EDITOR ${cpath}${cdf} - fi - ($apply) && cell ${cdf} + if [ -z "${EDITOR}" ] || [ -x "$(which ${EDITOR})" ]; then + unset EDITOR && vi ${cpath}${cdf} + else + $EDITOR ${cpath}${cdf} + fi + ($apply) && cell ${cdf} } # autocomplete for certain utilities diff --git a/tools/test/bin/ogroup-opts b/tools/test/bin/ogroup-opts index 41842bdd0d..f02b7a8fea 100644 --- a/tools/test/bin/ogroup-opts +++ b/tools/test/bin/ogroup-opts @@ -44,7 +44,7 @@ function _cell-opts () { fi } -complete -F _cell-opts cell +complete -F _cell-opts cell vicell # Tab completion settings for onos-create-app. diff --git a/tools/test/bin/onos-service b/tools/test/bin/onos-service index cc6949111d..35764e6f18 100755 --- a/tools/test/bin/onos-service +++ b/tools/test/bin/onos-service @@ -34,7 +34,6 @@ fi case $2 in start|stop|restart|status) - # Select the target if [ "${1}" = "--cell" ]; then nodes=$(env | sort | egrep "OC[0-9]+" | cut -d= -f2)