Class: Ace::Assign::CLI::Commands::List
- Inherits:
-
Support::Cli::Command
- Object
- Support::Cli::Command
- Ace::Assign::CLI::Commands::List
- Includes:
- Support::Cli::Base
- Defined in:
- lib/ace/assign/cli/commands/list.rb
Overview
List all assignments with state information
Constant Summary collapse
- COL_ID =
Column widths for table display
10- COL_NAME =
25- COL_STATUS =
12- COL_PROGRESS =
10- COL_STEP =
20- COL_UPDATED =
15- STATE_LABELS =
Status display labels
{ running: "running", paused: "paused", completed: "completed", failed: "failed", empty: "empty" }.freeze
Instance Method Summary collapse
Instance Method Details
#call(**options) ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/ace/assign/cli/commands/list.rb', line 51 def call(**) discoverer = Molecules::AssignmentDiscoverer.new manager = Molecules::AssignmentManager.new current_id = manager.current_id all_assignments = discoverer.find_all(include_completed: true) assignments = if [:task] all_assignments.select { |ai| ai.assignment.name == [:task] } .then { |filtered| [:all] ? filtered : filtered.reject(&:completed?) } elsif [:all] all_assignments else all_assignments.reject(&:completed?) end hidden_completed = [:all] ? 0 : all_assignments.count(&:completed?) if [:tree] print_tree(assignments) elsif [:format] == "json" print_json(assignments, current_id: current_id) else print_table(assignments, current_id: current_id, hidden_completed: hidden_completed) end end |