Last active
December 9, 2016 06:45
-
-
Save colstrom/e0f8ccafb71a0936830e73316a73f7b6 to your computer and use it in GitHub Desktop.
upcase.fish: converts strings to uppercase
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
| name = upcase | |
| author = Chris Olstrom | |
| license = MIT | |
| provides = fish/functions/upcase | |
| requires | |
| command/tr | |
| fish/builtin/case | |
| fish/builtin/count | |
| fish/builtin/echo | |
| fish/builtin/else | |
| fish/builtin/end | |
| fish/builtin/function | |
| fish/builtin/if | |
| fish/builtin/read | |
| fish/builtin/return | |
| fish/builtin/string | |
| fish/builtin/switch | |
| fish/builtin/while | |
| fish/functions/isatty | |
| fish/functions/list | |
| fish/functions/upcase |
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 upcase | |
| if isatty stdin | |
| switch (count $argv) | |
| case 0 | |
| echo 'usage: upcase <string> [string ...]' | |
| return 100 | |
| case '*' | |
| list $argv | upcase | |
| end | |
| else | |
| while read string | |
| echo $string | tr [:lower:] [:upper:] | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment