Searching for gists

1 · Shane Mulligan · Dec. 3, 2019, 11 a.m.
Create a gist-search script 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 #!/bin/bash export TTY ( hs "$(basename "$0")" "$@" "#" "<==" "$(ps -o comm= $PPID)" 0</dev/null ) &>/dev/null is_tty() { # If stout is a tty [[ -t 1 ]] } gr gist "$@" | grep //gist.github.com/ | urldecode | scrape ".*gist.github.com/[^?/]+" | sort | uniq | scrape "[^/]+$" | { if is_tty; then fzf | xa gist-list else cat fi } Demonstration...