Sha256: 1a136ae3014bdb349125f327a5900ebc26ea15a5f7398a6122e492caec836134

Contents?: true

Size: 487 Bytes

Versions: 2

Compression:

Stored size: 487 Bytes

Contents

require 'anvil/task'

class HelpTask < Anvil::Task
  description 'Help for the anvil tasks. Usage: anvil help TASK'

  parser do
    arguments %w(task_name)
  end

  attr_reader :task_name

  def initialize(task_name, options = {})
    @task_name = task_name
  end

  def task
    return default_message unless task_name.present?
    klazz = Anvil::Task.from_name(task_name)
    Anvil.logger.info(klazz.help)
  end

  def default_message
    Anvil.logger.info(self.class.help)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
anvil-core-0.6.0 lib/tasks/help_task.rb
anvil-core-0.5.0 lib/tasks/help_task.rb