Created
July 29, 2021 17:38
-
-
Save ipatch/d7eb6b31d59eb6301d8cd6659ca71b0c to your computer and use it in GitHub Desktop.
fish function syntax error
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function brew --description "catch common misspelling & add some goodies" | |
| if test -f /usr/local/bin/brew | |
| # REF: https://stackoverflow.com/a/60607145/708807 | |
| # thank you @faho | |
| switch "$argv[1]" | |
| case tap.ls | |
| echo "the $argv[2] tap provides the following formula"; | |
| echo "=================================" | |
| # echo "$argv[2]" # DEBUG | |
| if type -q jq | |
| # TODO: split line across multiple lines more gracefully | |
| command brew tap-info "$argv[2]" --json | jq -r '.[]|(.formula_names[],.cask_tokens[])' | |
| else | |
| echo "`jq` is required to output the list of formula provided the tap, install it with `brew install jq`" | |
| return | |
| end | |
| return; | |
| end | |
| switch "$argv[2]" | |
| # # TODO: could be implemented better, the 2nd arg `--greddy` seems to still issue an error with brew | |
| case outdated --greddy | |
| # echo "greedy NOT greddy"; | |
| # echo "=================================" | |
| command brew outdated --greedy | |
| # set_color -d; printf '\n%s' 'use '; set_color -o green; echo "brew outdated --greedy"; set_color normal | |
| case "*" | |
| command brew $argv | |
| end #switch | |
| switch "$argv[3]" | |
| case cask outdated --greddy | |
| echo "greedy NOT greddy"; | |
| echo "=================================" | |
| set_color -d red; echo "`brew cask outdated --greedy obsolete`"; set_color normal | |
| printf "use "; set_color -o green; echo "brew outdated --greedy"; set_color normal | |
| command brew outdated --greedy | |
| set_color -d; printf '\n%s' 'use '; set_color -o green; echo "brew outdated --greedy"; set_color normal | |
| case "*" | |
| command brew $argv | |
| end #switch | |
| else | |
| echo "brew not found" | |
| end # if test /usr/local/bin/brew | |
| end #function |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment