Skip to content

Instantly share code, notes, and snippets.

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

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

Select an option

Save colstrom/eda496c72cb94db52aa8814fe5da1c20 to your computer and use it in GitHub Desktop.
string-to-bool.fish: coerces strings into fixed true/false values
name = string-to-bool
author = Chris Olstrom
license = MIT
provides = fish/functions/string-to-bool
requires
fish/builtin/case
fish/builtin/echo
fish/builtin/end
fish/builtin/false
fish/builtin/function
fish/builtin/return
fish/builtin/string
fish/builtin/switch
fish/builtin/true
fish/functions/string-to-bool
function string-to-bool --argument string
switch "$string"
case false nil
echo false
return 1
case '*'
echo true
return 0
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment