summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/toru/toru46
1 files changed, 17 insertions, 29 deletions
diff --git a/src/toru/toru b/src/toru/toru
index f714fd8..34a7649 100755
--- a/src/toru/toru
+++ b/src/toru/toru
@@ -249,11 +249,6 @@ update() {
done # end repos
}
-# Find all the packages that are missing from the repo dbs (aka not built)
-missing() {
- true
-}
-
## Finds a PKGBUILD on toru's path cache
## usage: where_is <pkgname>
# Look in all caches but pick the first one
@@ -272,21 +267,16 @@ where_is() {
echo ${_path}
}
-# TODO: clean usage instructions
-function usage {
- echo ""
- echo "$0 [options] repo1 ... repon"
- echo ""
- echo "Make a db containing PKGBUILD metadata."
- echo ""
- echo "-h : this message"
- # echo "-a : update all repos at once"
- echo "-u : update repo information"
- echo "-q : quiet"
- echo "-f : rebuild the db even if it is updated"
- echo "-p <pkgname>: return the path for pkgname"
- echo ""
- exit 1
+usage() {
+ print 'Usage: %s [OPTIONS] REPO1...REPON' "${0##*/}"
+ print "Make a db containing PKGBUILD metadata."
+ echo
+ #flag '-a' "Update all repos at once" \
+ flag '-f' "Rebuild the db even if it is updated" \
+ "-p <$(_ PKGNAME)>" "Return the path for PKGNAME" \
+ '-q' "Quiet" \
+ '-u' "Update repo information" \
+ '-h' "Show this message"
}
## MAIN
@@ -294,22 +284,20 @@ commands=()
repos=()
quiet=false
force=false
-while getopts 'haqfpum' arg; do
+while getopts 'fp:quh' arg; do
case $arg in
- h) usage; exit 0 ;;
- # TODO: Update all repos on $REPOS array
- # a) update_all_repos ;;
- q) quiet=true ;;
+ #a) update_all_repos ;; # TODO: Update all repos on $REPOS array
f) force=true ;;
+ p) where_is "$OPTARG" || exit 1 ;;
+ q) quiet=true ;;
u) commands+=(update);;
- p) shift $(( OPTIND - 1 ))
- where_is "$1" || exit 1;;
- m) commands+=(missing);;
+ h) usage; exit 0 ;;
+ ?) usage 1>&2; exit 1 ;;
esac
shift $(( OPTIND - 1 ))
done
-
+[[ ${#commands[@]} -eq 0 ]] && { usage 1>&2; exit 1 ;;
TMPDIR=$(mktemp -d)