Last active
December 9, 2016 06:40
-
-
Save colstrom/eda496c72cb94db52aa8814fe5da1c20 to your computer and use it in GitHub Desktop.
string-to-bool.fish: coerces strings into fixed true/false values
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 = 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 |
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 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