Class: Command::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/command/base.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(dir, env, args, stdin, stdout, stderr) ⇒ Base

Returns a new instance of Base.



14
15
16
17
18
19
20
21
22
23
# File 'lib/command/base.rb', line 14

def initialize(dir, env, args, stdin, stdout, stderr)
  @dir    = dir
  @env    = env
  @args   = args
  @stdin  = stdin
  @stdout = stdout
  @stderr = stderr

  @isatty = @stdout.isatty
end

Instance Attribute Details

#statusObject (readonly)

Returns the value of attribute status.



12
13
14
# File 'lib/command/base.rb', line 12

def status
  @status
end

Instance Method Details

#executeObject



25
26
27
28
29
30
31
32
33
# File 'lib/command/base.rb', line 25

def execute
  parse_options
  catch(:exit) { run }

  if defined? @pager
    @stdout.close_write
    @pager.wait
  end
end