Skip to content

Commit

Permalink
CLI: Allow large task names on colt tasks show
Browse files Browse the repository at this point in the history
  • Loading branch information
neomilium committed Oct 29, 2024
1 parent a1ff23c commit 8c24703
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/choria/colt/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,12 @@ def extract_targets_from_options
def show_tasks_summary(tasks)
tasks.reject! { |_task, metadata| metadata['metadata']['private'] }

task_name_max_size = 0
tasks.each { |task, _metadata| task_name_max_size = [task_name_max_size, task.size].max }

puts <<~OUTPUT
#{pastel.title 'Tasks'}
#{tasks.map { |task, metadata| "#{task}#{' ' * (60 - task.size)}#{metadata['metadata']['description']}" }.join("\n").gsub(/^/, ' ')}
#{tasks.map { |task, metadata| "#{task}#{' ' * (task_name_max_size + 4 - task.size)}#{metadata['metadata']['description']}" }.join("\n").gsub(/^/, ' ')}
OUTPUT
end

Expand Down

0 comments on commit 8c24703

Please sign in to comment.