Class: Terraspace::CLI::Info
- Inherits:
-
Base
- Object
- Base
- Terraspace::CLI::Info
show all
- Extended by:
- Memoist
- Defined in:
- lib/terraspace/cli/info.rb
Instance Method Summary
collapse
Methods inherited from Base
#initialize
Methods included from Util
#pretty_path
Methods included from Util::Sure
#sure?
Methods included from Util::Sh
#sh
#logger
Instance Method Details
#info ⇒ Object
26
27
28
|
# File 'lib/terraspace/cli/info.rb', line 26
def info
@mod.to_info
end
|
#json_output ⇒ Object
10
11
12
|
# File 'lib/terraspace/cli/info.rb', line 10
def json_output
puts JSON.pretty_generate(info)
end
|
#rpad ⇒ Object
21
22
23
|
# File 'lib/terraspace/cli/info.rb', line 21
def rpad
info.keys.map(&:size).max
end
|
#run ⇒ Object
5
6
7
8
|
# File 'lib/terraspace/cli/info.rb', line 5
def run
format = @options[:format] || "text"
send("#{format}_output")
end
|
#text_output ⇒ Object
14
15
16
17
18
19
|
# File 'lib/terraspace/cli/info.rb', line 14
def text_output
info.each do |k,v|
k = "%-#{rpad}s" % k
puts "#{k} #{v}"
end
end
|