# ignore getopt's --, we don't care if an arg begins with - anyway
[ "$1" = '--' ] && switch >/dev/null
- all=$(apk info)
+ all=$(apk info | sort)
# show packages if no args
if [ $# -eq 0 ]; then
for x in $(echo "$all" | grep '^\.'); do
# replacing chars may result in variable collision—but
# official apk repos do not have any package names that
# would cause issues
- eval "__$(echo $c | tr -s '.:-' _)=1"
+ eval "__$(echo $c | tr -s '.:+-' _ | tr -s '<=~>@' "\n" | head -1)=1"
done
done
# check world against owned packages
orphans=$(
for x in $(cat /etc/apk/world | grep -v '^\.'); do
eval "[ \${__$(
- echo $x | tr -s '.:-' _ | tr -s '<=~>@' "\n" | head -1
+ echo $x | tr -s '.:+-' _ | tr -s '<=~>@' "\n" | head -1
)-0} -eq 0 ]" && echo $x
done
)