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

RFC: Refactor CLI into a single program, using argparse #462

Closed
wants to merge 4 commits into from
Closed

RFC: Refactor CLI into a single program, using argparse #462

wants to merge 4 commits into from

Conversation

paulmelnikow
Copy link
Member

entryPoint: (args: any) => {
dangerRun.main(args as dangerRun.App)
},
})
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a lot of repetition here which could be tightened up.

@orta
Copy link
Member

orta commented Dec 29, 2017

Want to leave this with me to wrap up?

@orta
Copy link
Member

orta commented Jan 1, 2018

I took a look into argparse, it has the exact same flaw as commander: no support for the subparsers being optional ( nodeca/argparse#58 nodeca/argparse#99 ) so I threw a few hours last night and this morning at adding it and couldn't get very far ( current WIP is in https://github.com/danger/danger-js/tree/paulmelnikow-refactor-cli )

@paulmelnikow
Copy link
Member Author

Lemme give that a poke. If it comes down to it I'd rather hack on argparse than on commander; the behavior is better documented and the code is in better shape. Worst case, we could wrap a try-catch around the parseArgs bit.

@orta orta mentioned this pull request Jan 1, 2018
@paulmelnikow
Copy link
Member Author

There's a debug option which does not really debug, but throws an exception when arguments are invalid. Creating a parser to handle the default invocation of danger run and trying that first, then falling back to the hybrid command: this seems to work.

@orta
Copy link
Member

orta commented Jan 2, 2018

OK, so I gave it a look yesterday also and figured it was probably time to take a clean look at all the CLI and ended up in a different place, I simplified Danger's CLI options and added a lot more documentation in #465

Docs: https://github.com/danger/danger-js/pull/465/files#diff-4ac32a78649ca5bdd8e0ba38b7006a1eR11

@paulmelnikow
Copy link
Member Author

Alright, seems like I should close this. Maybe I can jump in some other place.

@peril-staging
Copy link
Contributor

peril-staging bot commented Jan 2, 2018

Thanks for the PR @paulmelnikow.

We conform to the Moya Community Continuity Guidelines, which means
that we want to offer any contributor the ability to control their destiny.

So, we've sent you an org invite - thanks 🎉

Generated by 🚫 dangerJS

@orta
Copy link
Member

orta commented Jan 2, 2018

Peril still gave you invite for helping - that counts to me 👍

Thanks @paulmelnikow - dunno if this would have got fixed had you not started this

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

Successfully merging this pull request may close these issues.

None yet

2 participants