Skip to content

Cannot invoke tasks with required options from another task #614

Description

@clemensp

Given the following Thor class:

class Demo < Thor
  desc "parent_task", "this task will invoke the child task"

  def parent_task
    invoke(:child_task, [], required_option: "some value")
  end

  desc "child_task", "to be invoked by parent task"
  method_option "required_option", type: :string, required: true

  def child_task
    puts "Child task received the following options: #{p options}"
  end
end

When I execute:

thor demo:parent_task

Expected Output:

Child task received the following options: {"required_option"=>"some value"}

Actual Output:

No value provided for required options '--required-option'

Versions tested:

  • 0.19.1
  • 0.20.0

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions