pmurach
Show HN: TTY::Option - A declarative command-line parser for Ruby
Looking Inside a Ruby Gem
The Tao of Writing a Ruby Gem Specification
[1] http://tldp.org/LDP/abs/html/exitcodes.html [2] https://man.openbsd.org/signal.3
I have included a method that helps you check if a code is reserved or not. For example, TTY::Exit.exit_reserved?(126) will return true as this is a status used by Bash to indicate a problem with executing a command.
* It includes default user-friendly error messages for all the built-in exit codes. For example, the code 64 will print " "ERROR(64): Command line usage error" to stderr.
* Machines, e.i. programs that, for example, watch over an executable can decided based on the error code what to do. If the program is interrupted by Ctrl-C then the parent program can handle the situation gracefully.
I totally agree that an example of using an exit code in a parent program would be beneficial.
TTY-Exit: terminal exit codes for humans and machines
Working with Capistrano: Environment Variables and Remote Commands
Express numbers as word numerals in Ruby
Inflect English Nouns and Verbs in Ruby
Working with Capistrano: Tasks, Roles, and Variables
Streaming Large Zip Files in Rails
Software Product – Fake It Until You Make It?
tty-logger: a readable logging for the terminal
Bad Blood – A Tale of a Modern Vampire
Nobody Gives a Shit about Your Software
RSpec::Benchmark – Performance Testing in Ruby
Can you learn a programming language in 48 hours?
The Path to Learning a Programming Language
Show HN: Coinpare – Compare cryptocurrency trading data in your terminal
Show HN: Coinpare – Compare cryptocurrency trading data in your terminal
In my scripting experience I tend to gravitate towards two solutions. If my script is fairly small, e.i. in a single file, with no much complexity I tend to use Ruby standard library optparse. However, if my needs get a bit more complex and I need, for example, subcommands I use thor. Thor gives me a better way to structure my application logic. These two solutions so far have covered all my needs.
Other solutions that I've played in the past are:
* main - very sweet DSL (https://github.com/ahoward/main)
* clamp - (https://github.com/mdub/clamp)
* slop - (https://github.com/leejarvis/slop)
* gli - for Git-like interfaces (https://github.com/davetron5000/gli)
My recommendation before using other libraries would be to really give optparse a good spin so that you can figure out why the other options are more suitable.
There is still plenty of scripts that I write that are geared towards development workflow. I haven't had issues on setting up these tools on Debian servers, Ruby is usually preinstalled and all you need is bundler to get what you need.