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



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

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

#callObject



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

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

#contextObject



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

def context
	Context.load(self.bakefile_path)
end

#terminal(out = $stdout) ⇒ Object



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

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