Class: Ace::Idea::CLI::Commands::Show

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

Overview

ace-support-cli Command class for ace-idea 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/idea/cli/commands/show.rb', line 35

def call(ref:, **options)
  manager = Ace::Idea::Organisms::IdeaManager.new
  idea = manager.show(ref)

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

  if options[:path]
    puts idea.file_path
  elsif options[:content]
    puts File.read(idea.file_path)
  else
    puts Ace::Idea::Molecules::IdeaDisplayFormatter.format(idea, show_content: true)
  end
end