From 546b9aa3df462700668581f026dbf136924f3e20 Mon Sep 17 00:00:00 2001 From: Keith Peters Date: Thu, 23 Nov 2023 21:12:20 -0500 Subject: [PATCH] display a list of package managers with -p --- version | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/version b/version index a65775d..99c5b9a 100755 --- a/version +++ b/version @@ -213,6 +213,19 @@ list_tools() { sed -Ene 's/^tools_(.*)=(.*)/\1 \2/p' "$0" } +list_pms() { + echo "Supported package managers:" + echo " apt" + echo " brew" + echo " dnf" + echo " flatpak" + echo " macports" + echo " npm" + echo " pacman" + echo " pip" + echo " snap" +} + try_pacman() { # is pacman installed? (Arch and derivatives) command -v pacman >/dev/null 2>&1 || return @@ -386,6 +399,7 @@ then echo " (if known and installed)" echo " version -h display this help" echo " version -l display a list of known programs and their version flags" + echo " version -p display a list of supported package managers" echo " version -c display count of known programs" echo " version -v display version of version" echo " (yes, 'version version' also works!)" @@ -414,6 +428,13 @@ then exit fi +# Display all the tools we know +if [ $1 = "-p" ] +then + list_pms + exit +fi + # sanitize and find in the list sanitized=`echo "$1" | sed -e "s/-/_/"` tool=tools_$sanitized