Sha256: 4455bc4d592fe59ca61b647ed25f86a1d8b07032241692664850ed8f6518b16e

Contents?: true

Size: 465 Bytes

Versions: 3

Compression:

Stored size: 465 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)
    printf(klazz.help)
  end

  def default_message
    printf(self.class.help)
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
anvil-core-0.4.2 lib/tasks/help_task.rb
anvil-core-0.4.1 lib/tasks/help_task.rb
anvil-core-0.4.0 lib/tasks/help_task.rb