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
Unify cli input parsing #549
Conversation
Addresses issue #521 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's obvious but I wanted to point out it's a breaking change for the frontend, so it has to be coordinated with them.
The last thing I think is awkward with our CLIs is that subcommands take a --
(like migration-engine --can-connect-to-database
instead of migration-engine can-connect-to-database 'dev.db'
), which is kind of unusual.
use structopt::StructOpt; | ||
|
||
#[derive(Debug, StructOpt, Clone)] | ||
#[structopt(version = env!("GIT_HASH"))] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh I didn't know that option, it's great!
stdin: bool, | ||
/// Whether to ignore warnings from the migration engine regarding data loss. Default: false. | ||
#[structopt(long = "force")] | ||
#[structopt(long)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
didn't know that either, great!
fn main() { | ||
match FmtOpts::from_args() { | ||
FmtOpts::Lint(opts) => lint::run(opts), | ||
FmtOpts::Format(opts) => format::run(opts), | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
much better 💯
Yeah. But this way we have to provide only one of them. If this would be a struct, you could provide both but then the code would decide the order, like only execute |
Yep I meant not making non-subcommands, but removing the |
That was a mistake, and I'm adding them back now.
Sent from [ProtonMail](https://protonmail.ch), encrypted email based in Switzerland.
‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
…On Tuesday, March 3, 2020 5:31 PM, Tom Houlé ***@***.***> wrote:
Yep I meant not making non-subcommands, but removing the -- (ideally).
—
You are receiving this because you authored the thread.
Reply to this email directly, [view it on GitHub](#549?email_source=notifications&email_token=AAAIRF7IW74JU5HHUO46KALRFU5FLA5CNFSM4LAO6RG2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOENUNEIY#issuecomment-594072099), or [unsubscribe](https://github.com/notifications/unsubscribe-auth/AAAIRFZOWBPOYIWAADU4VZ3RFU5FLANCNFSM4LAO6RGQ).
|
c454130
to
d815f89
Compare
wait, I meant like the subcommands better without |
d815f89
to
ad88c54
Compare
ad88c54
to
56404d1
Compare
Yes. Actually. You're right. Let's go this way. |
56404d1
to
4ec1451
Compare
- Version command displays the binary name and commit id everywhere - All long cli params are now kebab-case instead of snake_case, the standard - The prisma-fmt has now subcommands `format` and `lint` instead of one boolean flag `lint` that when set lints and when not set formats.
4ec1451
to
9ebc450
Compare
format
andlint
instead of oneboolean flag
lint
that when set lints and when not set formats.This requires us to change the vscode plugin and prisma-client and prisma2 cli to support the new options.