Skip to content

Instantly share code, notes, and snippets.

@colstrom
Last active December 9, 2016 06:45
Show Gist options
  • Select an option

  • Save colstrom/e0f8ccafb71a0936830e73316a73f7b6 to your computer and use it in GitHub Desktop.

Select an option

Save colstrom/e0f8ccafb71a0936830e73316a73f7b6 to your computer and use it in GitHub Desktop.
upcase.fish: converts strings to uppercase
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
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