Class: Ace::Task::CLI::Commands::Show

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

Overview

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

Instance Method Summary collapse

Instance Method Details

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



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/ace/task/cli/commands/show.rb', line 38

def call(ref:, **options)
  manager = Ace::Task::Organisms::TaskManager.new
  task = manager.show(ref)

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

  if options[:path]
    puts task.file_path
  elsif options[:content]
    puts File.read(task.file_path)
  else
    puts Molecules::TaskDisplayFormatter.format(task, show_content: false)
  end
end