trollop lets you easily create script parameters with meaningful names, instead of useing ARGV[0], ARGV[1],…etc.
Announcement
You can find all my latest posts on medium.If you have the following in your ruby script:
cat ./testscript.rb #!/usr/bin/env ruby require 'trollop' opts = Trollop::options do opt :hostname, "Server FQDN.", :type => :string end puts opts[:hostname]
Next we install the gem:
$ gem install trollop
Now we have builtin “help” feature:
$ ruby ./testscript.rb --help Options: -h, --hostname=Server FQDN. -e, --help Show this message
Now if we do:
$ ruby ./testscript.rb --hostname=test.com test.com