Sha256: 628db568c8382bfb5ce299f858f0ef64a8850c6ed0c3be7865dbcd636ac18f77

Contents?: true

Size: 689 Bytes

Versions: 5

Compression:

Stored size: 689 Bytes

Contents

require "forwardable"

##
# Makes the following Commander methods globally available:
#
# * Commander::Runner#add_command
# * Commander::Runner#get_command
# * Commander::Runner#command
# * Commander::Runner#commands
# * Commander::Runner#program
# * Commander::UI::ProgressBar#progress

module Kernel
  extend Forwardable
  def_delegators :$command_runner, :add_command, :get_command, :command, :program, :run!, :commands
  def_delegators Commander::UI::ProgressBar, :progress
  
  def command_runner #:nodoc:
    $command_runner
  end
  
  def method_missing meth, *args, &block
    if meth.to_s =~ /^ask_for_([\w]+)/
      $terminal.ask args.first, eval($1.camelcase)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
visionmedia-commander-2.4.2 lib/commander/import.rb
visionmedia-commander-2.4.3 lib/commander/import.rb
visionmedia-commander-2.4.4 lib/commander/import.rb
visionmedia-commander-2.4.6 lib/commander/import.rb
visionmedia-commander-2.5.6 lib/commander/import.rb