Class: Tomo::Commands::Tasks

Inherits:
Tomo::CLI::Command show all
Includes:
Tomo::CLI::CommonOptions, Tomo::CLI::ProjectOptions
Defined in:
lib/tomo/commands/tasks.rb

Instance Method Summary collapse

Methods included from Tomo::CLI::CommonOptions

included

Methods included from Tomo::CLI::ProjectOptions

included

Methods inherited from Tomo::CLI::Command

after_parse, arg, option, parse, parser

Methods included from Tomo::Colors

enabled?

Instance Method Details



13
14
15
16
17
18
19
20
21
# File 'lib/tomo/commands/tasks.rb', line 13

def banner
  <<~BANNER
    Usage: #{green('tomo tasks')}

    List all tomo tasks (i.e. those that can be used with #{blue('tomo run')}).

    Available tasks are those defined by plugins loaded in #{DEFAULT_CONFIG_PATH}.
  BANNER
end

#call(options) ⇒ Object



23
24
25
26
27
28
29
30
31
# File 'lib/tomo/commands/tasks.rb', line 23

def call(options)
  runtime = configure_runtime(options, strict: false)
  tasks = runtime.tasks

  groups = tasks.group_by { |task| task[/^([^:]+):/, 1].to_s }
  groups.keys.sort.each do |group|
    logger.info(groups[group].sort.join("\n"))
  end
end

#summaryObject



9
10
11
# File 'lib/tomo/commands/tasks.rb', line 9

def summary
  "List all tasks that can be used with the #{yellow('run')} command"
end