47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
# File 'lib/collins/cli/formatter.rb', line 47
def format_assets(assets, opts = {})
opts = FORMATTING_DEFAULTS.merge(opts)
if assets.length > 0
case opts[:format]
when :table
columns = if opts[:column_override].empty?
opts[:columns].concat(search_attrs.keys).compact.uniq
else
opts[:column_override]
end
display_as_table(assets,columns,opts[:separator],opts[:show_header])
when :link
display_as_link assets, collins
when :json,:yaml
display_as_robot_talk(assets,opts[:format])
else
raise "I don't know how to display assets in #{opts[:format]} format!"
end
else
raise "No assets found"
end
end
|