mirror of
https://github.com/correl/melpa.git
synced 2024-12-22 19:17:27 +00:00
Better option handling.
This commit is contained in:
parent
fb5aa7ea50
commit
be8ed0045a
1 changed files with 34 additions and 5 deletions
39
melpa
39
melpa
|
@ -53,14 +53,39 @@ else print}' index.tmpl > index.md
|
|||
echo
|
||||
}
|
||||
|
||||
args=$@
|
||||
function print_usage {
|
||||
echo "usage: $0 [-h | -?] [update | clear | build | html | sync]"
|
||||
}
|
||||
|
||||
if [[ "$#" == "0" ]]; then
|
||||
args="update clear build index sync"
|
||||
args=`getopt h $*`
|
||||
errcode=$?
|
||||
|
||||
if [[ "$errcode" > 0 ]]; then
|
||||
print_usage
|
||||
exit $errcode
|
||||
fi
|
||||
|
||||
for task in $args; do
|
||||
case $task in
|
||||
set -- $args
|
||||
|
||||
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 ;;
|
||||
clear ) melpa_clear_packages ;;
|
||||
build ) melpa_build_pkglist ;;
|
||||
|
@ -70,4 +95,8 @@ for task in $args; do
|
|||
shift
|
||||
done
|
||||
|
||||
exit 1
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue