Class: Ace::Task::CLI::Commands::List

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

Overview

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

Constant Summary collapse

C =
Ace::Support::Items::Atoms::AnsiColors

Instance Method Summary collapse

Instance Method Details

#call(**options) ⇒ Object



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/ace/task/cli/commands/list.rb', line 45

def call(**options)
  status = options[:status]
  in_folder = options[:in]
  root = options[:root]
  tags_str = options[:tags]
  tags = tags_str ? tags_str.split(",").map(&:strip).reject(&:empty?) : []
  filters = options[:filter]
  sort = options[:sort] || "smart"

  manager = if root
    Ace::Task::Organisms::TaskManager.new(root_dir: File.expand_path(root))
  else
    Ace::Task::Organisms::TaskManager.new
  end

  list_opts = {status: status, tags: tags, filters: filters, sort: sort}
  list_opts[:in_folder] = in_folder if in_folder
  tasks = manager.list(**list_opts)

  puts Ace::Task::Molecules::TaskDisplayFormatter.format_list(
    tasks, total_count: manager.last_list_total,
    global_folder_stats: manager.last_folder_counts
  )
end