Method: Thor::Actions#thor
- Defined in:
- lib/thor/actions.rb
#thor(command, *args) ⇒ Object
Run a thor command. A hash of options can be given and it’s converted to switches.
Parameters
- command<String>
-
the command to be invoked
- args<Array>
-
arguments to the command
- config<Hash>
-
give :verbose => false to not log the status, :capture => true to hide to output. Other options are given as parameter to Thor.
Examples
thor :install, "http://gist.github.com/103208"
#=> thor install http://gist.github.com/103208
thor :list, :all => true, :substring => 'rails'
#=> thor list --all --substring=rails
308 309 310 311 312 313 314 315 316 317 318 319 |
# File 'lib/thor/actions.rb', line 308 def thor(command, *args) config = args.last.is_a?(Hash) ? args.pop : {} verbose = config.key?(:verbose) ? config.delete(:verbose) : true pretend = config.key?(:pretend) ? config.delete(:pretend) : false capture = config.key?(:capture) ? config.delete(:capture) : false args.unshift(command) args.push Thor::Options.to_switches(config) command = args.join(" ").strip run command, with: :thor, verbose: verbose, pretend: pretend, capture: capture end |