Class: Shadwire::Commands::Info

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

Overview

Shows one item's metadata: type, title, description, file targets, gems, importmap pins, and registry dependencies. Read-only. The file bodies (content) are stripped so both the JSON and human output stay a manifest, not a payload. An unknown name propagates RegistryError from the client.

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of Info.



12
13
14
15
16
17
18
# File 'lib/shadwire/commands/info.rb', line 12

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

Instance Method Details

#callObject



20
21
22
23
24
25
# File 'lib/shadwire/commands/info.rb', line 20

def call
  client = RegistryClient.new(@registry_override || Config.load(@root).registry)
  payload = strip_content(client.item(@name))
  emit(payload)
  payload
end