Skip to content

Instantly share code, notes, and snippets.

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

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

Select an option

Save colstrom/082d351d53ed984a27ae82cc814a599b to your computer and use it in GitHub Desktop.
status-to-bool.fish: converts exit statuses into boolean values
name = status-to-bool
author = Chris Olstrom
license = MIT
provides = fish/functions/status-to-bool
requires
fish/builtin/and
fish/builtin/case
fish/builtin/echo
fish/builtin/end
fish/builtin/exit
fish/builtin/false
fish/builtin/function
fish/builtin/return
fish/builtin/set
fish/builtin/switch
fish/builtin/test
fish/builtin/true
function status-to-bool --argument exit
set --local last $status
test -z "$exit"
and set exit $last
switch "$exit"
case 0
echo true
case '*'
echo false
end
return $exit
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment