-
-
Notifications
You must be signed in to change notification settings - Fork 371
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
Arguments aren't passed to run when using just 'danger' #177
Comments
When I install the latest version of danger, the executable JS file look like this:
There is nothing defined for a |
Yeah, the debugging options have always been an ENV var |
It is strange that the TypeScript source shows the |
Oops, I was looking at the wrong file. 😛 Still going to take a look. |
I wonder if this is related to tj/commander.js#469? |
I just ran into this setting up Danger for Shields. Would you be up for switching to argparse? It's a conscientious port of Python's absolutely delightful argument parser. It has a nice API, provides excellent error messages, and most importantly, does not allow errors to pass silently. I've used it in Node projects here and there and had good luck with it. If not, no worries. I'm just not that invested in fixing commander. |
Love your work <3. Yeah, I'm not committed to commander at all, I've not really figured out what's going on here ( as I consider our use case so vanilla too ) |
Thanks! My focus since joining Shields is scaling out contributions and I'm excited to get Danger into the mix. I'll give this a shot when I've a second. |
Seems like there are three ways to go about this:
Thoughts? |
2, yeah The expectations for args of each command is in an interface somewhere, so the arg parsing can just create an object which matches the same shape. Shouldn't be a hard refactor. |
Is there a faster way to run the updated CLI than a full I tried |
I'm not sure I understand this comment. It refers to dynamic properties, which must mean dynamic command-line arguments, though I can't see anywhere that a dynamic property of |
1, I don't think so - I very rarely use the build process, I run during dev time using ts-node: 2, danger-js/source/commands/utils/sharedDangerfileArgs.ts Lines 9 to 21 in e7ca5f2
|
1, Super helpful. I didn't know you could do that. It's my first time using TypeScript. Thanks! I have a first pass mostly done. It's a straight refactor, and does not fix the problem of args for plain I'll test it a little bit more and then PR it so you can take a look. Hoping you can help me test it also. I don't think the changes I'm making are covered with tests. |
Yeah, they won't be - I've always struggled with writing tests for the commands and opted to try move as much as possible outside of it. I'll give it a run when you've got something 👍 |
I took a stab at the simplest answer to this, which is duplicating the code for running across |
Didn't really fix it |
Hey, sorry I didn't respond earlier. Let me push up the half-done work I have. If it seems in a promising direction I'll pick it back up. Most of where I'm hung up at this point in the refactor is not understanding clearly which programs can accept which arguments. Some of them don't make sense for some commands, e.g. the command that takes a positional dangerfile shouldn't also accept one via flag. argparse is strict, so it's important to sort this out. I think going from the working multi-program runner to fix this issue will be straightforward enough. Basically it'd mean detecting which of the two cases we're in, then applying the appropriate argument parser. The "running" of the command is manual (you'll see in the branch) so there's no magic. |
I'm happy to either make those decisions ( positional dangerfiles shouldn't happen etc ) - I'm also happy to have you have a fresh perspective. As long as the runtime-y ones are consistent among: |
Okay, sure, I could bring my perspective on it. I'm not totally sure I understand what Also, is |
TLDR: Let's other environments use Danger in their language without implementing all the hard stuff.
|
So it needs to be able to be invoked via the OS somehow, adding an extra command just felt like the simplest answer |
Should be fixed in 3.0 which simplified all the CLI user interface |
https://circleci.com/gh/danger/danger-js/324
https://circleci.com/gh/danger/danger-js/325
After doing
I would have expected
yarn danger -- run --dangerfile dangerfile.circle.js
oryarn danger -- -d dangerfile.circle.js
to work. As that's what's in the code.but it didn't work:
weird
The text was updated successfully, but these errors were encountered: