Skip to content

Allow option to populate prompt response to sub tasks #1870

@onedr0p

Description

@onedr0p

Current issue

---
version: '3'
tasks:
  task-1:
    prompt: Task 1?
    cmds:
      - task: task-2
  task-2:
    prompt: Task 2?
    cmd: echo hello

With the above example if I run task task-1 --yes the task-2 will not ask for a prompt and run. However if I run task task-1 and answer y I still get prompted on task-2.

It would be great if there was a way to enable passing down the prompt response to sub-tasks. I am aware of work-arounds like instead of using - task: task-2 just use - task task-2 --yes but it doesn't seem very native and defeats the purpose of having the task: option in certain cases like this. If that is actually the suggested way to do it, that's fine.

Purposed solution

---
version: '3'
tasks:
  task-1:
    prompt: Task 1?
    cmds:
      - task: task-2
        propagate:
          prompt: true
          force: true # Could also be used to propagate `--force` to sub-tasks
  task-2:
    prompt: Task 2?
    cmd: echo hello

or allow the sub task to inherit the task calling it prompt reaponse

---
version: '3'
tasks:
  task-1:
    prompt: Task 1?
    cmds:
      - task: task-2
  task-2:
    prompt: Task 2?
    cmd: echo hello
    inherit_prompt_response: true

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