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 use of names for positional-args #2341

Closed
ross-spencer opened this issue Sep 3, 2024 · 2 comments
Closed

Allow use of names for positional-args #2341

ross-spencer opened this issue Sep 3, 2024 · 2 comments

Comments

@ross-spencer
Copy link

Current behavior is to use numbered args in a justfile:

set positional-arguments

@foo bar:
  echo $0
  echo $1

Given bar is labelled and just will report on it if it is missing from the recipe, some syntactic sugar might allow for it to be referenced by name in the recipe, e.g:

set positional-arguments

@foo bar:
  echo $0
  echo $bar

It might just reduce the learning curve of the format a little more for new users but also help make the recipe more reliable if that value need be repeated on any other lines without having to keep in mind the enumeration.

@laniakea64
Copy link
Contributor

set positional-arguments does not prevent the use of just variables -

set positional-arguments

@foo bar:
  echo $0
  echo {{bar}}

@ross-spencer
Copy link
Author

set positional-arguments does not prevent the use of just variables

ah, cool. Much nicer.

Feels like there's some skew in definition here between arg/variable but probably not worth going into.

Thanks for pointing that out!

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