How do I search for a PPA via CLI, commandline?

Solution 1:

Don't really understand why you'd want to search for PPAs from the command line because most people already have a browser window perpetually open. Here are a few options:

  • If you use a browser that supports adding keywords to bookmarks, you can bookmark https://launchpad.net/ubuntu/+ppas?name_filter=%s with keyword ppa. Then type ppa [package-name] into the URL bar to search.

  • If ppasearch does what you need, keep using it for as long as it continues to work. You can try contributing to development to add features or fix bugs. If developers are non-responsive, you can create a personal fork.

  • You can create your own script, similar to the following:

    #!/usr/bin/env bash
    
    function _show_help_ {
       echo "Usage:" `basename ${0}` "[options] [package-name]"
       echo "Open web browser to search Launchpad for [package-name]."
       echo
       echo "  -l, --list      List PPAs with link and description"
       echo "  -h, --help      Display this help and exit."
    }
    
    function msed {
       perl -0777 -pe "$@"
    }
    
    if [ $# -lt 1 ]; then
       _show_help_
       exit 1
    fi
    
    case "$1" in
       '-h'|'--help')
          _show_help_
          ;;
       '-l'|'--list')
          shift
          curl -s "https://launchpad.net/ubuntu/+ppas?name_filter=$@" \
              | pandoc -f html -t markdown \
              | msed 's@[\s\S]*<div id="ppa_list">@@' \
              | msed 's@\]\(@\]\(https://launchpad.net/@'
              | grep -E '^\s+\[' \
              | msed 's@^\s+@@' \
              | msed 's@\s+[0-9]+\s+[0-9]+\s+@\n@g'
          ;;
       *)
          xdg-open "https://launchpad.net/ubuntu/+ppas?name_filter=$@"
          ;;
    esac
    

    This script opens a link to a Launchpad search for the given package in the default browser. With the appropriate flag -l, it outputs a list of PPA names with their URLs and descriptions.

    You can add additional features as you encounter the need for them.