Add extern def which allows raw arguments#8956
Conversation
|
The issue gives important context for this, but basically nu needs some way for functions to accept raw arguments instead of parsed arguments. In the issue @kubouch suggested using |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #8956 +/- ##
==========================================
+ Coverage 68.19% 68.56% +0.36%
==========================================
Files 636 636
Lines 101752 101798 +46
==========================================
+ Hits 69393 69795 +402
+ Misses 32359 32003 -356
|
|
Thanks for this. It's less code than I thought there would be. Nice job! One question, does it really fix #7758? I'm not sure how this is going to change the OP's original problem with built-in commands. I think it does solve the problem for calling external executables, like if you wanted to wrap |
|
also tagging @kubouch who was thinking about this, too |
|
Cool, I also expected more code. I would include a bit more test cases. Can you define other parameters (like |
You're right that it doesn't really address the original issue, I will remove that from the description.
It doesn't allow other parameters, and it must include a rest parameter.
|
|
OK, sounds good, but I think the signature should support other parameters, just like |
How do you think this should combine with raw options? |
|
Every parameter not defined in the signature, instead of throwing an error, would be a string collected in would define This shouldn't be very hard because commands defined with |
|
Ah okay, i’ll see if i can add that
|
0bfa2b4 to
fa36c58
Compare
|
Yea it seems everything works this way so this is even better |
|
The failing check is due to problems with the github api |
|
Yeah, the CI is flaky sometimes. Can you restart the job? I think there is an option for it somewhere, or you can force-push into the branch to force the reset. EDIT: I managed to reset the job. |
|
I don’t have permission to restart the job and I have nothing to push
|
you should be able to
to force the CI to trigger 😏 |
|
thanks @pingiun, let's see how it goes 😋 |
|
Very cool! |

Description
Extends the
externsyntax to allow commands that accept raw arguments. This is mainly added to allow wrapper type scripts for external commands.This is an example on how this can be used:
(It's only possible to accept a single ...varargs argument in the signature)
User-Facing Changes
No breaking changes, just extra possibilities.
Tests + Formatting
Added a test for this new behaviour and ran the toolkit pr checker
After Submitting
This is advanced functionality but it should be documented, I will open a new PR on the book for that