Class: Ace::Retro::CLI::Commands::Show

Inherits:
Support::Cli::Command
  • Object
show all
Includes:
Support::Cli::Base
Defined in:
lib/ace/retro/cli/commands/show.rb

Overview

ace-support-cli Command class for ace-retro show

Instance Method Summary collapse

Instance Method Details

#call(ref:, **options) ⇒ Object



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/ace/retro/cli/commands/show.rb', line 35

def call(ref:, **options)
  manager = Ace::Retro::Organisms::RetroManager.new
  retro = manager.show(ref)

  unless retro
    raise Ace::Support::Cli::Error.new("Retro '#{ref}' not found")
  end

  if options[:path]
    puts retro.file_path
  elsif options[:content]
    puts File.read(retro.file_path)
  else
    puts Ace::Retro::Molecules::RetroDisplayFormatter.format(retro, show_content: true)
  end
end