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

Allow pattern matching on task signatures #1894

Open
trashhalo opened this issue Feb 10, 2024 · 1 comment
Open

Allow pattern matching on task signatures #1894

trashhalo opened this issue Feb 10, 2024 · 1 comment

Comments

@trashhalo
Copy link

Instead of doing a chain of if else if statements I think the justfile syntax would be cleaner if it supported pattern matching

kubectl "staging" "app" *args:
  Kubectl --context=dhdhdjd -n djdjsjdj-app {{ args }}

kubectl "prod" "app" *args:
# etcetc

Vs

kubectl env service *args:
  context = if env == "staging" { "djfjfnfn} # else if for every env
  deployment = if app == # etc etc
@casey
Copy link
Owner

casey commented Feb 11, 2024

The syntax would probably have to be something like:

kubectl @staging @app *args:

And not arbitrary strings, just because of the way the parser works. This is a cool feature, although it might be quite a large change to how recipe dispatch works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants