Class: Bake::Command::Top

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

Instance Method Summary collapse

Instance Method Details

#bakefileObject



59
60
61
# File 'lib/bake/command/top.rb', line 59

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

#callObject



67
68
69
70
71
72
73
# File 'lib/bake/command/top.rb', line 67

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

#contextObject



63
64
65
# File 'lib/bake/command/top.rb', line 63

def context
	Context.load(self.bakefile)
end

#terminal(out = $stdout) ⇒ Object



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/bake/command/top.rb', line 42

def terminal(out = $stdout)
	terminal = Console::Terminal.for(out)
	
	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