Module: Swa::CLI::CollectionBehaviour
- Defined in:
- lib/swa/cli/collection_behaviour.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(target) ⇒ Object
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 |
# 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 ["data", "d"], "Full details" do parameter "[QUERY]", "JMESPath expression" def execute display_data(collection.map(&:data).to_a, query) end end end |