pipx.sh
Add description et link to package
This commit is contained in:
+37
-6
@@ -36,10 +36,6 @@ then
|
||||
exit
|
||||
fi
|
||||
|
||||
list=$(pipx list --include-injected) # pipx list --quiet
|
||||
echo -e "\n${underline}List installed packages:${reset}"
|
||||
echo "$list"
|
||||
|
||||
curl -Is https://www.apple.com | head -1 | grep 200 1>/dev/null
|
||||
if [[ $? -eq 1 ]]; then
|
||||
echo -e "\n${red}No Internet connection !${reset}"
|
||||
@@ -47,20 +43,56 @@ if [[ $? -eq 1 ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
list=$(pipx list --include-injected) # pipx list --quiet
|
||||
echo -e "\n${underline}List installed packages:${reset}"
|
||||
#echo "$list"
|
||||
|
||||
while IFS= read -r line; do
|
||||
|
||||
if grep -q 'package.*,' <<< "${line}"
|
||||
then
|
||||
pyPkgName=$(echo "${line}" | awk -F" " '{print $2}' )
|
||||
|
||||
infoPkg=$(curl -s https://pypi.org/pypi/${pyPkgName}/json | jq -r '.info')
|
||||
summaryPkg=$(echo "$infoPkg" | jq -r '.summary')
|
||||
srcUrl=$(echo "$infoPkg" | jq -r '.project_urls' | jq -r '.Homepage')
|
||||
|
||||
inf="$summaryPkg\n"" ${italic}$srcUrl${reset}"
|
||||
echo -e "\n${bold}${line}${reset}\n ${inf}"
|
||||
else
|
||||
echo -e "${line}"
|
||||
fi
|
||||
|
||||
done <<< "$list"
|
||||
|
||||
|
||||
pinned=$(pipx list --pinned)
|
||||
echo -e "\n${underline}Pinned packages:${reset}"
|
||||
echo "$pinned"
|
||||
echo -e "To unpin, please enter ${italic}pipx unpin <package>${reset}"
|
||||
|
||||
# curl -s https://pypi.org/pypi/mkdocs/json | jq -r '.info.summary'
|
||||
# curl -s https://pypi.org/pypi/mkdocs/json | jq -r '.info.version'
|
||||
# curl -s https://pypi.org/pypi/mkdocs/json | jq -r '.info.project_url'
|
||||
|
||||
pipx-outdated() {
|
||||
echo -e "\n${underline}Outdated Packages:${reset}"
|
||||
while read -sr pyPkgName pyPkyVersion; do
|
||||
local pypi_latest="$(curl -sS https://pypi.org/simple/${pyPkgName}/ | grep -o '>.*</' | tail -n 1 | grep -o -E '[0-9]([0-9]|[-._])*[0-9]')"
|
||||
#[ "$pyPkyVersion" != "$pypi_latest" ] && printf "%s\tCurrent: %s\tLatest: %s\n" "$pyPkgName" "$pyPkyVersion" "$pypi_latest"
|
||||
if [ "$pyPkyVersion" != "$pypi_latest" ]; then
|
||||
if [[ "$pinned" == *"$pyPkgName"* ]]; then
|
||||
printf "${red}%s\tCurrent: %s\tLatest: %s (pinned)${reset}\n" "$pyPkgName" "$pyPkyVersion" "$pypi_latest"
|
||||
else
|
||||
printf "%s\tCurrent: %s\tLatest: %s\n" "$pyPkgName" "$pyPkyVersion" "$pypi_latest"
|
||||
outdated+="$pyPkgName "
|
||||
fi
|
||||
fi
|
||||
|
||||
done < <( pipx list | grep -o 'package.*,' | tr -d ',' | cut -d ' ' -f 2- )
|
||||
}
|
||||
|
||||
# https://github.com/avantrec/soco-cli/blob/master/CHANGELOG.txt
|
||||
|
||||
pipx-outdated
|
||||
|
||||
@@ -71,7 +103,6 @@ if [ -n "$outdated" ]; then
|
||||
nb=$(echo "$outdated" | wc -w | xargs)
|
||||
echo -e "${redbox} $nb ${reset} availables updates:"
|
||||
|
||||
|
||||
a=$(echo -e "\nDo you wanna run ${bold}pipx upgrade "$outdated"${reset} ? (y/n/a) ")
|
||||
# yes/no/all
|
||||
read -p "$a" choice
|
||||
|
||||
Reference in New Issue
Block a user