Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preconditions should have "platforms" for ease of use #1373

Open
uded opened this issue Oct 17, 2023 · 1 comment
Open

Preconditions should have "platforms" for ease of use #1373

uded opened this issue Oct 17, 2023 · 1 comment
Labels
state: needs triage Waiting to be triaged by a maintainer.

Comments

@uded
Copy link

uded commented Oct 17, 2023

For all preconditions right now there is an sh (for command) and msg.

My suggestion is to add platforms to the preconditions, as this would greatly simplify creating different, sometimes somewhat complex commands to test for them. Yes, I am aware that I can achieve the same using some if-else template or by including external OS-specific taskfile, but in my case that grow into something like 500 character line to achieve a goal of creating different precondition script for different platform. When I realized that it would be so much simpler with a simple platforms clause...

How I would like to see it? Example (commands are just provides as is, doesn't matter if they would work or not):

  build:
    desc: Build a project
    silent: true
    preconditions:
      - sh: command -v /usr/local/bin/go-enum
        platforms: [linux]
        msg: missing go-enum executable (https://github.com/abice/go-enum)
      - sh: Get-Command "go-enum.exe"
        platforms: [windows]
        msg: missing go-enum executable (https://github.com/abice/go-enum)   
@task-bot task-bot added the state: needs triage Waiting to be triaged by a maintainer. label Oct 17, 2023
@KimKellerRasmussen
Copy link

It looks like you can do something like this:

build:
  cmds:
    - echo "All is good!"
  preconditions: 
    - sh: task check
      msg: missing go-enum executable (https://github.com/abice/go-enum)
check:
  cmds:
    - cmd: command -v /usr/local/bin/go-enum
      platforms: [linux]
    - cmd: Get-Command "go-enum.exe"
      platforms: [windows]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
state: needs triage Waiting to be triaged by a maintainer.
Projects
None yet
Development

No branches or pull requests

3 participants