add second example usage to README
This commit is contained in:
parent
96277b62d0
commit
55389866ee
22
README.md
22
README.md
@ -22,7 +22,7 @@ Or install it yourself as:
|
||||
|
||||
$ gem install yawpa
|
||||
|
||||
## Usage
|
||||
## Example 1
|
||||
|
||||
require 'yawpa'
|
||||
|
||||
@ -36,6 +36,26 @@ Or install it yourself as:
|
||||
opts.each_pair do |opt, val|
|
||||
end
|
||||
|
||||
## Example 2
|
||||
|
||||
require 'yawpa'
|
||||
|
||||
options = {
|
||||
version: {},
|
||||
help: {short: 'h'},
|
||||
}
|
||||
opts, args = Yawpa.parse(ARGV, options, posix_order: true)
|
||||
if opts[:version]
|
||||
puts "my app, version 1.2.3"
|
||||
end
|
||||
if args[0] == 'subcommand'
|
||||
subcommand_options = {
|
||||
'server': {nargs: (1..2), short: 's'},
|
||||
'dst': {nargs: 1, short: 'd'},
|
||||
}
|
||||
opts, args = Yawpa.parse(args, subcommand_options)
|
||||
end
|
||||
|
||||
## Contributing
|
||||
|
||||
1. Fork it
|
||||
|
Loading…
x
Reference in New Issue
Block a user