slitaz-base-files rev 137

libtaz.sh: Store all cmdline options in a variable
author Christophe Lincoln <pankso@slitaz.org>
date Mon Apr 23 23:30:48 2012 +0200 (2012-04-23)
parents a9f3ad0aff28
children 4ea029af10e8
files rootfs/lib/libtaz.sh testsuite.sh
line diff
     1.1 --- a/rootfs/lib/libtaz.sh	Tue Apr 17 01:03:14 2012 +0200
     1.2 +++ b/rootfs/lib/libtaz.sh	Mon Apr 23 23:30:48 2012 +0200
     1.3 @@ -22,16 +22,12 @@
     1.4  okcolor=32
     1.5  ercolor=31
     1.6  
     1.7 -# Parse cmdline options.
     1.8 +# Parse cmdline options and store values in a variable.
     1.9  for opt in "$@"
    1.10  do
    1.11  	case "$opt" in
    1.12 -		--raw-out)
    1.13 -			output="raw" ;;
    1.14 -		--gtk-out)
    1.15 -			output="gtk" ;;
    1.16 -		--html-out)
    1.17 -			output="html" ;;
    1.18 +		--*=*) export ${opt#--} ;;
    1.19 +		--*) export ${opt#--}="yes" ;;
    1.20  	esac
    1.21  done
    1.22  [ "$HTTP_REFERER" ] && output="html"
    1.23 @@ -50,9 +46,7 @@
    1.24    check_root
    1.25  
    1.26  Options:
    1.27 -  --raw-out
    1.28 -  --gtk-out
    1.29 -  --html-out
    1.30 +  --output=[raw|gtk|html]
    1.31   
    1.32  EOT
    1.33  }
     2.1 --- a/testsuite.sh	Tue Apr 17 01:03:14 2012 +0200
     2.2 +++ b/testsuite.sh	Mon Apr 23 23:30:48 2012 +0200
     2.3 @@ -21,5 +21,8 @@
     2.4  output="raw"
     2.5  check_libtaz
     2.6  
     2.7 -echo ""
     2.8 +[ "$forced" ] && echo "Checking option: forced=$forced"
     2.9 +[ "$root" ] && echo "Checking option: root=$root"
    2.10 +[ ! "$1" ] && echo "Check options: $(basename $0) --forced --root=/dev/null"
    2.11 +
    2.12  exit 0