#!/bin/zsh # Display help. if [[ $1 == "-h" || $1 == "--help" ]]; then echo "Available commands:" echo " user [user]" echo " eg. lookup user quaxlyqueen" echo " repo [user] [repo]" echo " eg. lookup repo quaxlyqueen/dnd" echo " -h" echo " --help" # Lookup a user. elif [[ $1 == "user" ]]; then firefox "https://github.com/search?q=$2&type=users" # Lookup a repo. elif [[ $1 == "repo" ]]; then firefox "https://github.com/search?q=$2&type=repositories" # Catch any invalid input. else echo "Improper usage: lookup [command] [search term]" echo "Available commands:" echo " user [user]" echo " eg. lookup user quaxlyqueen" echo " repo [user] [repo]" echo " eg. lookup repo quaxlyqueen/dnd" fi