Add description et link to package
This commit is contained in:
2026-09-04 16:45:03 +02:00
parent a03c25ebf9
commit 92d07bb589
+61 -30
View File
@@ -36,10 +36,6 @@ then
exit exit
fi 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 curl -Is https://www.apple.com | head -1 | grep 200 1>/dev/null
if [[ $? -eq 1 ]]; then if [[ $? -eq 1 ]]; then
echo -e "\n${red}No Internet connection !${reset}" echo -e "\n${red}No Internet connection !${reset}"
@@ -47,20 +43,56 @@ if [[ $? -eq 1 ]]; then
exit 1 exit 1
fi 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() { pipx-outdated() {
echo -e "\n${underline}Outdated Packages:${reset}" echo -e "\n${underline}Outdated Packages:${reset}"
while read -sr pyPkgName pyPkyVersion; do 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]')" 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" #[ "$pyPkyVersion" != "$pypi_latest" ] && printf "%s\tCurrent: %s\tLatest: %s\n" "$pyPkgName" "$pyPkyVersion" "$pypi_latest"
if [ "$pyPkyVersion" != "$pypi_latest" ]; then if [ "$pyPkyVersion" != "$pypi_latest" ]; then
printf "%s\tCurrent: %s\tLatest: %s\n" "$pyPkgName" "$pyPkyVersion" "$pypi_latest" if [[ "$pinned" == *"$pyPkgName"* ]]; then
outdated+="$pyPkgName " 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 fi
done < <( pipx list | grep -o 'package.*,' | tr -d ',' | cut -d ' ' -f 2- ) done < <( pipx list | grep -o 'package.*,' | tr -d ',' | cut -d ' ' -f 2- )
} }
# https://github.com/avantrec/soco-cli/blob/master/CHANGELOG.txt
pipx-outdated pipx-outdated
@@ -71,31 +103,30 @@ if [ -n "$outdated" ]; then
nb=$(echo "$outdated" | wc -w | xargs) nb=$(echo "$outdated" | wc -w | xargs)
echo -e "${redbox} $nb ${reset} availables updates:" 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
a=$(echo -e "\nDo you wanna run ${bold}pipx upgrade "$outdated"${reset} ? (y/n/a) ") if [ "$choice" == "y" ] || [ "$choice" == "Y" ] || [ "$choice" == "a" ] || [ "$choice" == "A" ]; then
# yes/no/all for i in $outdated;
read -p "$a" choice do
if [ "$choice" == "y" ] || [ "$choice" == "Y" ]; then
if [ "$choice" == "y" ] || [ "$choice" == "Y" ] || [ "$choice" == "a" ] || [ "$choice" == "A" ]; then if [ "$injected" = true ]; then
for i in $outdated; echo "$i" | xargs -p -n 1 pipx upgrade --include-injected
do else
if [ "$choice" == "y" ] || [ "$choice" == "Y" ]; then echo "$i" | xargs -p -n 1 pipx upgrade
if [ "$injected" = true ]; then
echo "$i" | xargs -p -n 1 pipx upgrade --include-injected
else
echo "$i" | xargs -p -n 1 pipx upgrade
fi
elif [ "$choice" == "a" ] || [ "$choice" == "A" ]; then
if [ "$injected" = true ]; then
pipx upgrade-all --include-injected
else
pipx upgrade-all
fi
fi fi
done elif [ "$choice" == "a" ] || [ "$choice" == "A" ]; then
else if [ "$injected" = true ]; then
echo -e "OK, let's continue..." pipx upgrade-all --include-injected
fi else
pipx upgrade-all
fi
fi
done
else
echo -e "OK, let's continue..."
fi
else else
echo "No update available !" echo "No update available !"