Subcommand Handling #13
-
|
Hey, I am using This is the implementation I currently have: require 'command_mapper/command'
class Git < CommandMapper::Command
command "git" do
subcommand "log" do
option "--max-count", value: {type: Num.new()}
end
end
end
Git.run({ :log => { :max_count => 5 }})Is this how it is intended to be done? Are there any examples showcasing the usage of subcommands? Thanks in advance |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
|
Yes that is how you invoke a subcommand, by passing a nested Hash of options into the outer-command. All of the same execution methods can be used (ex: |
Beta Was this translation helpful? Give feedback.
Yes that is how you invoke a subcommand, by passing a nested Hash of options into the outer-command. All of the same execution methods can be used (ex:
.run,.spawn,.capture,.popen,.sudo) to execute subcommands. Off the top of my head, there's ruby-amass which defines subcommands for the amass CLI.