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

"error: unknown option" in versions later than 0.5.4 #5

Closed
antesaj opened this issue Apr 5, 2022 · 7 comments
Closed

"error: unknown option" in versions later than 0.5.4 #5

antesaj opened this issue Apr 5, 2022 · 7 comments

Comments

@antesaj
Copy link

antesaj commented Apr 5, 2022

In version 0.5.4, args passed like jr dev -x, for example, are forwarded to jobs.js so they can be passed to scripts, but in every later version all args yield error: unknown option '-x'.

@jraymakers
Copy link
Owner

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.

@jraymakers
Copy link
Owner

(Separately, I noticed that the commander upgrade seems to have also broken other options, and I have a fix for that.)

@jraymakers
Copy link
Owner

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.

@antesaj
Copy link
Author

antesaj commented Apr 6, 2022

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!

@jraymakers
Copy link
Owner

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!)

@antesaj
Copy link
Author

antesaj commented Apr 6, 2022

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

@jraymakers
Copy link
Owner

Ah, I see. That's why I didn't recognize your name. Thanks for carrying on the Prep mission at Tableau!

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