Module: Luciq::QueryOptions
- Defined in:
- lib/luciq/query_cli.rb
Overview
Shared Thor option groups for query commands.
Constant Summary collapse
- MODES =
%w[beta production staging alpha qa development].freeze
Class Method Summary collapse
- .app(thor) ⇒ Object
- .page(thor) ⇒ Object
- .raw_filters(thor) ⇒ Object
- .sort(thor, sort_by_enum: nil) ⇒ Object
Class Method Details
.app(thor) ⇒ Object
11 12 13 14 |
# File 'lib/luciq/query_cli.rb', line 11 def self.app(thor) thor.option :slug, type: :string, required: true, desc: 'Application slug' thor.option :mode, type: :string, required: true, enum: MODES, desc: 'Application mode' end |
.page(thor) ⇒ Object
16 17 18 19 |
# File 'lib/luciq/query_cli.rb', line 16 def self.page(thor) thor.option :offset, type: :numeric, desc: 'Number of results to skip' thor.option :limit, type: :numeric, desc: 'Maximum number of results to return' end |
.raw_filters(thor) ⇒ Object
26 27 28 29 |
# File 'lib/luciq/query_cli.rb', line 26 def self.raw_filters(thor) thor.option :filters, type: :string, desc: 'Raw filter JSON object, merged in (typed filter flags win on key conflicts)' end |
.sort(thor, sort_by_enum: nil) ⇒ Object
21 22 23 24 |
# File 'lib/luciq/query_cli.rb', line 21 def self.sort(thor, sort_by_enum: nil) thor.option :sort_by, type: :string, enum: sort_by_enum, desc: 'Sort field' thor.option :direction, type: :string, enum: %w[asc desc], desc: 'Sort direction' end |