Better option handling.

This commit is contained in:
Donald Ephraim Curtis 2012-01-20 20:40:29 -06:00
parent fb5aa7ea50
commit be8ed0045a

39
melpa
View file

@ -53,14 +53,39 @@ else print}' index.tmpl > index.md
echo echo
} }
args=$@ function print_usage {
echo "usage: $0 [-h | -?] [update | clear | build | html | sync]"
}
if [[ "$#" == "0" ]]; then args=`getopt h $*`
args="update clear build index sync" errcode=$?
if [[ "$errcode" > 0 ]]; then
print_usage
exit $errcode
fi fi
for task in $args; do set -- $args
case $task in
for i; do
case "$i" in
-h | -?) print_usage
shift
exit
;;
--) shift
break
;;
esac
done
if [[ "$#" == "0" ]]; then
set -- update clear build index sync
fi
for i; do
case $i in
update ) melpa_update_epkgs ;; update ) melpa_update_epkgs ;;
clear ) melpa_clear_packages ;; clear ) melpa_clear_packages ;;
build ) melpa_build_pkglist ;; build ) melpa_build_pkglist ;;
@ -70,4 +95,8 @@ for task in $args; do
shift shift
done done
exit 1