Closed antesaj closed 2 years ago
Interesting. I've confirmed this. Thanks for the report.
From what I can tell, this was due to changes in the commander
library. (The upgrade of jr
from 0.5.4 to 0.5.5 upgraded commander
from 2.9.0 to 5.1.0. I suspect this change to commander
is the main culprit.)
Passing args to the jobs file was never an intended feature. In fact, they don't really get forwarded; it's just that the jobs file gets loaded into the same node process, so it can see the same args. That, and commander
(before the aforementioned change) used to strip unknown options from the list of arguments, so they wouldn't cause "unknown option" errors or get interpreted as job names by jr
.
This is a bit tricky to "fix" because, in theory, job names can look like options. So, in your example, there might be a job named -x
. But that's not a good practice because it could conflict with existing and future options. So perhaps I can disallow such job names, or at least not cause an error when they're encountered.
(Separately, I noticed that the commander upgrade seems to have also broken other options, and I have a fix for that.)
Ok, I've published a new version of jr
(0.5.10) that should fix this scenario. Give it a try and let me know how it works for you.
Ah okay - thanks for explaining that. I wasn't aware of the mechanics of it. I do think the ability to pass options to the new Node processes is a very useful feature for jr
.
But yes, 0.5.10 fixed the issue on my end. I did notice before that it always recognized anything prefixed with -
as an option and anything else as a job name.
Thanks for updating and for continuing to support this package, Jeff!
Glad to hear this fixes the issue for you!
I'm curious how you've been using jr
. What projects do you use it with? What features do you use? (Besides options to jobs files!)
Well, you could say that you know the details better than I do, since I've only recently joined the Prep team at Tableau =D
Ah, I see. That's why I didn't recognize your name. Thanks for carrying on the Prep mission at Tableau!
In version 0.5.4, args passed like
jr dev -x
, for example, are forwarded tojobs.js
so they can be passed to scripts, but in every later version all args yielderror: unknown option '-x'
.