From 4501c85fbc29468facc1c9ed80161fb721b926ff Mon Sep 17 00:00:00 2001 From: davidovski Date: Wed, 15 Jun 2022 21:13:29 +0100 Subject: added pretty info command --- src/xi.sh | 42 +++++++++++++++++++----------------------- 1 file changed, 19 insertions(+), 23 deletions(-) (limited to 'src/xi.sh') diff --git a/src/xi.sh b/src/xi.sh index 92222f9..923612c 100755 --- a/src/xi.sh +++ b/src/xi.sh @@ -133,6 +133,21 @@ done . ${LIBDIR}/get.sh . ${LIBDIR}/remove.sh +do_install () { + [ "$#" = "0" ] && set -- $(installed) + + toinstall=${CACHE_DIR}/toinstall + + echo "" > $toinstall + tofetch="" + for f in $@; do + [ -f "$f" ] && echo $f >> $toinstall || tofetch="$tofetch$f " + done + + get $tofetch + install $(cat $toinstall) +} + shift $((OPTIND-1)) if [ "$#" = "0" ]; then @@ -147,19 +162,7 @@ else "install" | "update") shift checkroot - - [ "$#" = "0" ] && set -- $(installed) - - toinstall=${CACHE_DIR}/toinstall - - echo "" > $toinstall - tofetch="" - for f in $@; do - [ -f "$f" ] && echo $f >> $toinstall || tofetch="$tofetch$f " - done - - get $tofetch - install $(cat $toinstall) + do_install $@ ;; "build") shift @@ -187,8 +190,8 @@ else "reinstall") shift checkroot - $0 remove $@ - $0 install $@ + remove $@ + do_install $@ ;; "files") shift @@ -221,14 +224,7 @@ else ;; "info") shift - for package in $@; do - infofile=${INSTALLED_DIR}/$package/info - [ -f $infofile ] && { - cat $infofile - } || { - printf "Package info for $package could not be found!" - } - done + info $@ ;; "verify") shift -- cgit v1.2.1