contrib: lsupgrade: optimize output

- Use printf instead of echo for better portability
- Print whole path without reordering components
- Deduplicate code
This commit is contained in:
Matthias Schiffer 2022-01-03 02:46:05 +01:00
parent c0afb9cc39
commit c7e38fdc2c
No known key found for this signature in database
GPG Key ID: 16EF3F64CB201D9C

View File

@ -37,13 +37,12 @@ find ./package packages -name Makefile | grep -v '^packages/packages/' | while r
dirname="$(dirname "$dir" | cut -d/ -f 3-)" dirname="$(dirname "$dir" | cut -d/ -f 3-)"
package="$(basename "$dir")" package="$(basename "$dir")"
for file in "${SUFFIX1}"/*; do for file in "${SUFFIX1}"/* "${SUFFIX2}"/*; do
echo "${GREEN}$(basename "${file}")${RESET}" "(${BLUE}${repo}${RESET}/${dirname}${dirname:+/}${RED}${package}${RESET}/${SUFFIX1})" basename="$(basename "${file}")"
done suffix="$(dirname "${file}")"
for file in "${SUFFIX2}"/*; do printf "%s\t%s\n" "${basename}" "${BLUE}${repo}${RESET}/${dirname}${dirname:+/}${RED}${package}${RESET}/${suffix}/${GREEN}${basename}${RESET}"
echo "${GREEN}$(basename "${file}")${RESET}" "(${BLUE}${repo}${RESET}/${dirname}${dirname:+/}${RED}${package}${RESET}/${SUFFIX2})"
done done
popd >/dev/null popd >/dev/null
done | sort done | sort | cut -f2-
popd >/dev/null popd >/dev/null