Can scripts ran from the `scripts` module be given arguments?

Scenario is as follows, I have a simple build-script type situation going on for building something with cargo, then installing it and cleaning up build deps I'd like to make it more re-usable, so instead of hard-coding the git repo URL I wanted to take it in as $argv[1] (in fish) But I am unsure, if I do something like:
- type: script
scripts:
- build.fish "argument"
- type: script
scripts:
- build.fish "argument"
will the argument be passed to the script? If not, I can deal with that
Solution:
seems it takes that as one argument, not as script + argument That explains it, should probably be documented...
No description
Jump to solution
7 Replies
fiftydinar
fiftydinar2w ago
It's undocumented, but I think it should work, as it's launching /tmp/files/scripts/build.fish argument in your case Let me know if it works
Solution
Alexia ΘΔ
Alexia ΘΔ2w ago
seems it takes that as one argument, not as script + argument That explains it, should probably be documented
No description
Luke Skywunker
You can always run a snippet and specify the full path to the script
- type: script
snippets:
- /tmp/files/scripts/build.fish "argument"
- type: script
snippets:
- /tmp/files/scripts/build.fish "argument"
fiftydinar
fiftydinar2w ago
I think it would be good to add this support natively in scripts: though
Alexia ΘΔ
Alexia ΘΔOP2w ago
yeah I figured, just wanted to try and see even if just for documentation purposes
fiftydinar
fiftydinar2w ago
I didn't thought about this usecase, but I see it's useful
Alexia ΘΔ
Alexia ΘΔOP2w ago
in the end I realized that what I had as an idea wouldn't quite work anyways so I just made one big build-script instead of one that takes arguments if I don't forget (I almost certainly will) I might PR the documentation though

Did you find this page helpful?