diff options
author | Tim Rogers <tim@gocardless.com> | 2015-06-13 18:40:32 +0100 |
---|---|---|
committer | Tim Rogers <tim@gocardless.com> | 2015-06-13 18:40:32 +0100 |
commit | fd0e2d8bc3d1c647e6b051f48b8bedbe77934c0c (patch) | |
tree | 38105cadafc1b4f0609121b1d2f043af46ed4425 /README.md | |
parent | 1a075c05d38be0df849119530378043994c05c91 (diff) | |
download | slop-fd0e2d8bc3d1c647e6b051f48b8bedbe77934c0c.tar.gz |
Better handling of option names with multiple words
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -22,19 +22,21 @@ opts = Slop.parse do |o| o.integer '--port', 'custom port', default: 80 o.bool '-v', '--verbose', 'enable verbose mode' o.bool '-q', '--quiet', 'suppress output (quiet mode)' + o.bool '-c', '--check-ssl-certificate', 'check SSL certificate for host' o.on '--version', 'print the version' do puts Slop::VERSION exit end end -ARGV #=> -v --host 192.168.0.1 +ARGV #=> -v --host 192.168.0.1 --check-ssl-certificate -opts[:host] #=> 192.168.0.1 -opts.verbose? #=> true -opts.quiet? #=> false +opts[:host] #=> 192.168.0.1 +opts.verbose? #=> true +opts.quiet? #=> false +opts.check_ssl_certificate? #=> true -opts.to_hash #=> { host: "192.168.0.1", port: 80, verbose: true, quiet: false } +opts.to_hash #=> { host: "192.168.0.1", port: 80, verbose: true, quiet: false, check_ssl_certificate: true } ``` Option types |