Skip to content

Commit

Permalink
display a list of package managers with -p
Browse files Browse the repository at this point in the history
  • Loading branch information
bit101 committed Nov 24, 2023
1 parent a0d6121 commit 546b9aa
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions version
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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!)"
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 546b9aa

Please sign in to comment.