Skip to content

Instantly share code, notes, and snippets.

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

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

Select an option

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