crystal-parameters v1.0.5
crystal-parameters
Parse parameters from a string and output a array of strings that is usable with OptionParser#parse
.
It is usefull on interactive app accepting complex commands, like text bots.
Installation
-
Add the dependency to your
shard.yml
:dependencies: crystal-parameters: github: erdnaxeli/crystal-parameters
-
Run
shards install
Usage
require "option_parser"
require "parameters"
parameters = Parameters.parse("ls -lh --author --hide '* *' /tmp")
# => ["ls", "-lh", "--author", "--hide", "* *", "/tmp"]
if parameters
OptionParser.parse(parameters) do |parser|
parser.on("ls", "list files") { }
end
end
Development
Make sure to run make test
and make lint
:)
Contributing
- Fork it (https://github.com/erdnaxeli/crystal-parameters/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
- erdnaxeli - creator and maintainer
Repository
crystal-parameters
Owner
Statistic
- 0
- 0
- 0
- 1
- 1
- over 3 years ago
- October 31, 2020
License
MIT License
Links
Synced at
Thu, 07 Nov 2024 07:10:51 GMT
Languages