README.md in command_mapper-0.1.2 vs README.md in command_mapper-0.2.0

- old
+ new

@@ -41,12 +41,15 @@ * Supports mapping in sub-commands. * Allows running the command via `IO.popen` to read the command's output. * Allows running commands with additional environment variables. * Allows overriding the command name or path to the command. * Allows running commands via `sudo`. -* Prevents command injection and option injection. +* Prevents [command injection] and [option injection]. +[command injection]: https://owasp.org/www-community/attacks/Command_Injection +[option injection]: https://staaldraad.github.io/post/2019-11-24-argument-injection/ + [CommandMapper::Types::Str]: https://rubydoc.info/gems/command_mapper/CommandMapper/Types/Str [CommandMapper::Types::Num]: https://rubydoc.info/gems/command_mapper/CommandMapper/Types/Num [CommandMapper::Types::Hex]: https://rubydoc.info/gems/command_mapper/CommandMapper/Types/Hex [CommandMapper::Types::Map]: https://rubydoc.info/gems/command_mapper/CommandMapper/Types/Map [CommandMapper::Types::Enum]: https://rubydoc.info/gems/command_mapper/CommandMapper/Types/Enum @@ -71,11 +74,11 @@ option "--extended-regexp" option "--fixed-strings" option "--basic-regexp" option "--perl-regexp" option "--regexp", equals: true, value: true - option "--file", equals: true, value: true + option "--file", name: :patterns_file, equals: true, value: true option "--ignore-case" option "--no-ignore-case" option "--word-regexp" option "--line-regexp" option "--null-data" @@ -140,10 +143,22 @@ ```ruby option "--output", value: {required: true} ``` +Defines an option that uses an equals sign (ex: `--output=value`): + +```ruby +option "--output", equals: true, value: {required: true} +``` + +Defines an option where the value is embedded into the flag (ex: `-Ivalue`): + +```ruby +option "-I", value: {required: true}, value_in_flag: true +``` + Defines an option that can be specified multiple times: ```ruby option "--include-dir", repeats: true ``` @@ -152,10 +167,16 @@ ```ruby option "--count", value: {type: Num.new} ``` +Define an option that only accepts a range of acceptable values: + +```ruby +option "--count", value: {type: Num.new(range: 1..100)} +``` + Defines an option that accepts a comma-separated list: ```ruby option "--list", value: {type: List.new} ``` @@ -366,21 +387,21 @@ ``` ### Gemfile ```ruby -gem 'command_mapper', '~> 0.1' +gem 'command_mapper', '~> 0.2' ``` ### gemspec ```ruby -gemspec.add_dependency 'command_mapper', '~> 0.1' +gemspec.add_dependency 'command_mapper', '~> 0.2' ``` ## License -Copyright (c) 2021 Hal Brodigan +Copyright (c) 2021-2022 Hal Brodigan See {file:LICENSE.txt} for license information. [command_mapper]: https://github.com/postmodern/command_mapper.rb#readme [ruby]: https://www.ruby-lang.org/