8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/swa/cli/collection_behaviour.rb', line 8
def self.included(target)
target.default_subcommand = "summary"
target.subcommand ["summary", "s"], "One-line summary" do
def execute
collection.each do |i|
puts i.summary
end
end
end
target.subcommand ["ids"], "Just print ids" do
def execute
collection.each do |i|
puts i.id
end
end
end
target.subcommand ["data", "d"], "Full details" do
parameter "[QUERY]", "JMESPath expression"
def execute
display_data(collection.map(&:data).to_a, query)
end
end
end
|