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

Improve shell() documentation #2060

Merged
merged 2 commits into from
May 20, 2024
Merged

Improve shell() documentation #2060

merged 2 commits into from
May 20, 2024

Conversation

laniakea64
Copy link
Contributor

@laniakea64 laniakea64 commented May 20, 2024

  • Document that some shells will assign the first argument to $0 and thus it won't be in $@, and add an example demonstrating this
  • Fix bugs in example code
  • Expand the examples to showcase shell()'s power more
  • Clarify one comment

@casey
Copy link
Owner

casey commented May 20, 2024

Ahh, good catch. When running linewise recipes, we actually supply the command as the first argument, so that positional arguments appear in the expected variables. We should consider copying this behavior for the shell() function. It would be odd if:

x := shell('echo $1', 'bar')

foo bar:
   echo $1

x and the output of `just foo bar' were different.

@casey
Copy link
Owner

casey commented May 20, 2024

I just merged #2061 which passes the command being run as the first argument to shell(). I think the other changes here are good though, if you want to rebase.

@laniakea64
Copy link
Contributor Author

I think the other changes here are good though, if you want to rebase.

Done. Also added which just version shell() was introduced.

@casey casey enabled auto-merge (squash) May 20, 2024 19:29
@casey casey merged commit 178d4e2 into casey:master May 20, 2024
5 checks passed
@casey
Copy link
Owner

casey commented May 20, 2024

Merged!

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 this pull request may close these issues.

2 participants