Change option to -o | --output-dir and fix problem with pointing this dir

Changing option to more intuitive -o like output-dir and also there
was missing shift so option to point output dir didn't work correctly

Change-Id: I2233a295301b903e465bafa6720d1d4e28d60b18
This commit is contained in:
Artur Zarzycki 2017-01-25 13:26:46 +01:00
parent cbfd8bf89b
commit 0dc4941f61
1 changed files with 4 additions and 4 deletions

View File

@ -33,7 +33,7 @@ function usage {
Usage: $0 [-o LOG_DIR] [-n NAMESPACE] Usage: $0 [-o LOG_DIR] [-n NAMESPACE]
-h|--help Print this help -h|--help Print this help
-l|--log-dir Logs output directory (optional - default /tmp/ccp-diag) -o|--output-dir Logs output directory (optional - default /tmp/ccp-diag)
-n|--namespace Kubernetes namespace (optional - default ccp) -n|--namespace Kubernetes namespace (optional - default ccp)
EOF EOF
exit exit
@ -94,7 +94,7 @@ function ccp_data {
# Parse command line arguments: # Parse command line arguments:
OPTS=`getopt -o 'hl:n:' --long help,log-dir:,namespace: -n 'parse-options' -- ${@}` OPTS=`getopt -o 'ho:n:' --long help,output-dir:,namespace: -n 'parse-options' -- ${@}`
if [ ${?} != 0 ] ; then if [ ${?} != 0 ] ; then
echo "Failed parsing options." echo "Failed parsing options."
exit 1 exit 1
@ -104,8 +104,8 @@ eval set -- ${OPTS}
while [ -n "${1}" ]; do while [ -n "${1}" ]; do
case ${1} in case ${1} in
-h|--help ) usage; shift ;; -h|--help ) usage; shift ;;
-l|--log-dir ) LOG_DIR=${2}; shift; shift ;; -o|--output-dir ) LOG_DIR=${2}; shift; shift ;;
-n|--namespace ) NAMESPACE=${2}; shift ;; -n|--namespace ) NAMESPACE=${2}; shift; shift ;;
-- ) shift; break ;; -- ) shift; break ;;
* ) break ;; * ) break ;;
esac esac