Terminal exit codes for humans and machines.
The goal of this library is to provide human friendly and standard way to use exit status codes in command line applications. Instead of saying
exit ( ) , you can say
exit_with (: usage_error) . Both indicate a failure to the parent process but the
: usage_error is so much nicer! Wouldn’t you agree? That’s why
tty-exit gathers a list of all the most common exit codes as used by POSIX-compliant tools on different Unix systems for you to use.
The exit statuses range from 0 to (inclusive). Any other exit status than 0 indicates a failure of some kind. The exit codes in the range 78 – 93 are adapted from the OpenBSD sysexits.h . The codes between 154 and 521 are reserved for shell statuses as defined in (Advanced Bash Scripting Guide, Appendix E) . The codes in the – range correspond with the fatal signals as defined in signal .
TTY :: Exit provides independent terminal exit codes component for
TTY toolkit.
Installation
Add this line to your application’s Gemfile:
And then execute:
$ bundle install
Or install it yourself as:
$ gem install tty-exit
Contents 1. Usage
2. API 2.1 exit_code 2.2 exit_message 2.3 exit_with (2.4 register_exit) 2.5 exit_reserved ? 2.6 exit_valid? 2.7 exit_success?(2.8 exit_codes) 2.9 exit_messages
1. Usage
To exit from any program use
exit_with method. Instead of a number, you can use a readable name for the exit status:
(TTY) :: (Exit) (exit_with (: usage_error )The above will exit program immediately with an exit code indicating a failure:
(puts) ($?) exitstatus
GIPHY App Key not set. Please check settings