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 inverted cfg attributes, like [not(macos)] #1895

Open
casey opened this issue Feb 11, 2024 · 2 comments · May be fixed by #2393
Open

Allow inverted cfg attributes, like [not(macos)] #1895

casey opened this issue Feb 11, 2024 · 2 comments · May be fixed by #2393

Comments

@casey
Copy link
Owner

casey commented Feb 11, 2024

No description provided.

@mkatychev
Copy link

reposting #604 (comment):

[@]casey are there any discussions on doing cargo style [not(condition)]/[condition] annotations?:

[not(windows)]
run:
  cc main.c
  ./a.out
  
[windows]
run:
  cl main.c
  main.exe

I imagine my usecase is quite common for some when dealing with doing/avoiding setup specific to CI environments:

[env_var("CI") == "true"]
run:
  ./do_the_ci_setup.sh
  ./run.sh

[not(env_var("CI") == "true")]
run:
  ./run.sh

@W1M0R
Copy link

W1M0R commented Jun 20, 2024

This would be very useful. My use case is for shell detection:

[env_var("SHELL") == "bash"]
tips:
  @echo "Setup your shell like this:"

[env_var("SHELL") == "zsh"]
tips:
  @echo "Setup your shell like this:"

Although, for shell detection, it would be nice to have built-in attributes like we have for os detection, e.g.

[bash]
tips:
  @echo "Setup your shell like this:"

[zsh]
tips:
  @echo "Setup your shell like this:"

[ps1]
tips:
  Write-Host "Setup your shell like this:"

With shell detection attributes, one could even have recipes per-shell. The current shell options set the global shell interpreter for the file, but with shell attributes, we can support multiple different shells in the same justfile. This can probably become its own feature request. Maybe this request is related to #531.

neunenak added a commit to neunenak/just that referenced this issue Sep 27, 2024
neunenak added a commit to neunenak/just that referenced this issue Sep 27, 2024
@neunenak neunenak linked a pull request Sep 27, 2024 that will close this issue
neunenak added a commit to neunenak/just that referenced this issue Sep 28, 2024
neunenak added a commit to neunenak/just that referenced this issue Dec 11, 2024
neunenak added a commit to neunenak/just that referenced this issue Dec 12, 2024
neunenak added a commit to neunenak/just that referenced this issue Dec 12, 2024
neunenak added a commit to neunenak/just that referenced this issue Dec 12, 2024
neunenak added a commit to neunenak/just that referenced this issue Dec 17, 2024
neunenak added a commit to neunenak/just that referenced this issue Dec 17, 2024
neunenak added a commit to neunenak/just that referenced this issue Dec 18, 2024
neunenak added a commit to neunenak/just that referenced this issue Dec 24, 2024
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

Successfully merging a pull request may close this issue.

3 participants