curlhub (527B)
1 #!/bin/sh 2 # Curl wrapper to simplify downloading a raw file from Github. 3 # e.g. to download https://github.com/koalaman/shellcheck/blob/master/src/ShellCheck/AST.hs 4 # do `curlhub koalaman/shellcheck src/ShellCheck/AST.h` 5 command -v curl 1>/dev/null 2>&1 || { printf "curl not installed\n" && exit 1; } 6 [ $# -lt 2 ] && { printf "Usage:\tcurlhub username/repository filename [branch]\n" && exit 1; } 7 lnk="https://raw.githubusercontent.com/$1/${3:-master}/$2" 8 printf "%s\n" "Saving to current directory from $lnk" 9 curl -LO "$lnk"