Class: Shadwire::Commands::List

Inherits:
Object
  • Object
show all
Defined in:
lib/shadwire/commands/list.rb

Overview

Lists the registry catalog: one entry (name/type/title/description) per published item. Read-only — needs a registry but no Rails app. With json: true it emits the catalog array; otherwise a "name — title" line each.

Instance Method Summary collapse

Constructor Details

#initialize(root:, registry: nil, json: false, ui: UI.new) ⇒ List

Returns a new instance of List.



11
12
13
14
15
16
# File 'lib/shadwire/commands/list.rb', line 11

def initialize(root:, registry: nil, json: false, ui: UI.new)
  @root = root.to_s
  @registry_override = registry
  @json = json
  @ui = ui
end

Instance Method Details

#callObject



18
19
20
21
22
23
# File 'lib/shadwire/commands/list.rb', line 18

def call
  client = RegistryClient.new(@registry_override || Config.load(@root).registry)
  items = client.index.fetch("items", [])
  emit(items)
  items
end