#!/usr/bin/env bash # pipx plugin for KYMSU # https://github.com/welcoMattic/kymsu # No distract mode (no user interaction) [[ $@ =~ "-nodistract" || $@ =~ "-n" ]] && no_distract=true || no_distract=false # Upgrade --include-injected injected=true # Add module to the do_not_update array for prevent to update. #declare -a do_not_update=() italic="\033[3m" underline="\033[4m" ita_under="\033[3;4m" bgd="\033[1;4;31m" red="\033[1;31m" bold="\033[1m" box="\033[1;41m" reset="\033[0m" echo -e "${bold}🛠 pipx (Python 3) ${reset}" if ! command -v pipx &> /dev/null then echo -e "${bold}pipx${reset} could not be found !\n" echo -e "You should install ${bold}pipx${reset}:\n" echo -e " - brew install pipx" echo -e " - pipx ensurepath" echo -e "or" echo -e " - python3 -m pip install --user pipx" echo -e " - python3 -m pipx ensurepath" exit fi 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}" echo -e "Exit !" 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 ${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 '>.*