Skip to content

after interactive task, all tasks are executed #2402

@pasman1

Description

@pasman1

Description

In taskfile I have an interactive task:

version: '3'
vars:
  src: ./
  dst: piwrt.local::LINUX/
  options: -a --safe-links --progress --exclude=.Trash

tasks:
  default:
    cmds:
      - task -l; echo "================="
      - select goal in try-backup backup try-restore restore; do echo "Selected $goal"; task $goal; done
    silent: true
    interactive: true

  try-backup:
    desc: Backup current directory
    cmd: rsync --dry-run {{.options}} {{.src}} {{.dst}}

  backup:
    desc: Backup current directory
    cmd: rsync {{.options}} {{.src}} {{.dst}}

  try-restore:
    desc: Restore current directory
    cmd: rsync --dry-run {{.options}} {{.dst}} {{.src}}

  restore:
    desc: Restore current directory
    cmd: rsync {{.options}} {{.dst}} {{.src}}

When goal is selected and selected task is executed, the loop is
stopped and all tasks are executed.

$ task
task: Available tasks for this project:
* backup:            Backup current directory
* restore:           Restore current directory
* try-backup:        Backup current directory
* try-restore:       Restore current directory
=================
1) try-backup
2) backup
3) try-restore
4) restore
#? 1
Selected try-backup
task: [try-backup] rsync --dry-run -a --safe-links --progress --exclude=.Trash ./ piwrt.local::LINUX/
sending incremental file list
./
Taskfile.yml
Selected try-backup
task: [try-backup] rsync --dry-run -a --safe-links --progress --exclude=.Trash ./ piwrt.local::LINUX/
sending incremental file list
./
Taskfile.yml
Selected backup
task: [backup] rsync -a --safe-links --progress --exclude=.Trash ./ piwrt.local::LINUX/
sending incremental file list
./
Taskfile.yml
            736 100%    0,00kB/s    0:00:00 (xfr#1, to-chk=427/430)
Selected try-restore
task: [try-restore] rsync --dry-run -a --safe-links --progress --exclude=.Trash piwrt.local::LINUX/ ./
receiving incremental file list
ignoring unsafe symlink "APP-FLAT/flatpak" -> "/mnt/f80d5c3b-2b72-4782-8d1b-c7a5531900eb/APP/flatpak"
Selected restore
task: [restore] rsync -a --safe-links --progress --exclude=.Trash piwrt.local::LINUX/ ./
receiving incremental file list
ignoring unsafe symlink "APP-FLAT/flatpak" -> "/mnt/f80d5c3b-2b72-4782-8d1b-c7a5531900eb/APP/flatpak"
zara@AORUS-ELITE:/mnt/f80d5c3b-2b72-4782-8d1b-c7a5531900eb$ task --version
3.44.1

Version

3.44.1

Operating system

Linuxmint 22.2

Experiments Enabled

No response

Example Taskfile

Metadata

Metadata

Assignees

No one assigned

    Labels

    state: needs triageWaiting to be triaged by a maintainer.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions