flag_parser.cr
flag_parser
Yet another command line flag parser library :)
Installation
Add this to your application's shard.yml
:
dependencies:
flag_parser:
github: bew/flag_parser.cr
Usage
require "flag_parser"
value = 0
args = %w(--option 42)
FlagParser.parse args do |parser|
parser.add_rule "VALUE", FlagParser::Rule::NUM
parser.on "-o VALUE", "--option VALUE", doc: "Set option value" do |(a_value)|
value = a_value.to_i
end
end
puts value # => 42
TODO: Write more usage instructions here
TODO
[ ] execution policy (1. parse all THEN exec handler, 2. or parse AND exec when possible) 1. will be hard (impossible ?) when a callback comsume arguments based on runtime state.. ? [ ] recursive options : options that are applied on subparsers [ ] Exceptions on missing or no match
Contributing
- Fork it ( https://github.com/bew/flag_parser.cr/fork )
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create a new Pull Request
Contributors
- bew Benoit de Chezelles - creator, maintainer
Repository
flag_parser.cr
Owner
Statistic
- 1
- 0
- 0
- 0
- 0
- over 7 years ago
- October 8, 2016
License
MIT License
Links
Synced at
Sun, 17 Nov 2024 19:30:28 GMT
Languages