Class: Bake::Command::Top

Inherits:
Samovar::Command
  • Object
show all
Defined in:
lib/bake/command/top.rb

Overview

The top level command line application.

Instance Method Summary collapse

Instance Method Details

#bakefile_pathObject



49
50
51
# File 'lib/bake/command/top.rb', line 49

def bakefile_path
  @options[:bakefile] || Dir.pwd
end

#callObject



57
58
59
60
61
62
63
# File 'lib/bake/command/top.rb', line 57

def call
  if @options[:help]
    self.print_usage
  else
    @command.call
  end
end

#contextObject



53
54
55
# File 'lib/bake/command/top.rb', line 53

def context
  Context.load(self.bakefile_path)
end

#terminal(output = self.output) ⇒ Object



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/bake/command/top.rb', line 32

def terminal(output = self.output)
  terminal = Console::Terminal.for(output)
  
  terminal[:context] = terminal[:loader] = terminal.style(nil, nil, :bold)
  terminal[:command] = terminal.style(nil, nil, :bold)
  terminal[:description] = terminal.style(:blue)
  
  terminal[:key] = terminal[:opt] = terminal.style(:green)
  terminal[:req] = terminal.style(:red)
  terminal[:keyreq] = terminal.style(:red, nil, :bold)
  terminal[:keyrest] = terminal.style(:green)
  
  terminal[:parameter] = terminal[:opt]
  
  return terminal
end