README.md in command_mapper-0.3.1 vs README.md in command_mapper-0.3.2

- old
+ new

@@ -351,10 +351,45 @@ Grep.sudo(patterns: "Error", file: "/var/log/syslog") # Password: # ... ``` +### Defining sub-commands + +```ruby +module Git + class Command < CommandMapper::Command + + command 'git' do + option "--version" + option "--help" + option "-C", name: :dir, value: {type: InputDir.new} + # ... + + subcommand :clone do + option "--bare" + option "--mirror" + option "--depth", value: {type: Num.new} + # ... + + argument :repository + argument :directory, required: false + end + + # ... + end + + end +end +``` + +### Invoking sub-commands + +```ruby +Git::Command.run(clone: {repository: 'https://github.com/user/repo.git'}) +``` + ### Code Gen [command_mapper-gen] can automatically generate command classes from a command's `--help` output and/or man page. @@ -388,10 +423,22 @@ end end ``` +### Real-World Examples + +* [ruby-nmap](https://github.com/postmodern/ruby-nmap#readme) +* [ruby-masscan](https://github.com/postmodern/ruby-masscan#readme) +* [ruby-amass](https://github.com/postmodern/ruby-amass#readme) +* [ruby-yasm](https://github.com/postmodern/ruby-yasm#readme) +* [ruby-ncrack](https://github.com/postmodern/ruby-ncrack#readme) +* [ruby-nikto](https://github.com/postmodern/ruby-nikto#readme) +* [ruby-gobuster](https://github.com/postmodern/ruby-gobuster#readme) +* [ruby-feroxbuster](https://github.com/postmodern/ruby-feroxbuster#readme) +* [ruby-rustscan](https://github.com/postmodern/ruby-rustscan#readme) + ## Requirements * [ruby] >= 2.0.0 ## Install @@ -409,9 +456,13 @@ ### gemspec ```ruby gemspec.add_dependency 'command_mapper', '~> 0.2' ``` + +## Alternatives + +* [terrapin](https://github.com/thoughtbot/terrapin#readme) ## License Copyright (c) 2021-2022 Hal Brodigan