-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Cannot get past "Are you sure you want to drop the database" prompt #1406
Comments
You need to hit Enter. |
FWIW sqlx-cli is the only CLI I've seen that guards dangerous operation this way. Especially |
@abonander The current behavior is confusing. Do you agree? There are known UX patterns for handling user confirmations before dangerous operations. The current way does not fit any of those. Do you agree? If you disagree, I can explain. |
The behavior I wanted was what
So you'd just type
The capital I agree that the current implementation tries a little too hard, and it's confusing that hitting The CLI uses the |
@abonander I'm going to return to my original questions... Should I interpret your answer as two "disagree"s? The current behavior has these characteristics: I just want to check if we are seeing the same behavior. Once we're on the same page here, we can figure out how to fix it. I'll follow the trail wherever it leads. I appreciate your work on this crate. If it is a problem with dialoguer, I'll chase it down. All of this said, I have a hunch that this crate's use of async for handling CLI I/O is a contributing factor to this problem. |
sqlx-cli does not use async I/O for stdin/stdout. I agree that it should show the user response and not clear and re-print the prompt. That's what I meant by "trying too hard". The confirmation is done via the So this is an issue with the behavior of |
To clarify, let's go back to my statement "... I have a hunch that this crate's use of async for handling CLI I/O is a contributing factor to this problem." Here is what I was referring to:
A program doesn't have to start the Tokyo runtime with An alternative way to setup the sqlx CLI app would be to have a non-async Back to the main topic: All of this said, I created a dialoguer sample app and found that two out of three of these happen: (1) User keypresses are not printed to the screen. |
You're missing the It is not an async I/O issue which you can see as there is no |
This was intentional, because I wanted a minimal example. This confirms that the issues I'm seeing in sqlx come from dialoguer.
#[tokio::main]
async fn main() {
let matches = Opt::into_app().version(crate_version!()).get_matches();
// no special handling here
if let Err(error) = sqlx_cli::run(Opt::from_arg_matches(&matches)).await {
println!("{} {}", style("error:").bold().red(), error);
std::process::exit(1);
}
} ^^^ There is an |
Yes, but in the specific context where |
@abonander Have you read https://journal.stuffwithstuff.com/2015/02/01/what-color-is-your-function/ ? Also, do you understand why I'm asking this question? |
Also, I'm not sure if you followed me when I was saying this:
|
To clarify, I never said it was "an async I/O" issue. Here is what I said:
Do you understand why I'm making this clarification? |
Tell me what you think is happening and why lifting it out of an |
I've tried very hard to ask questions -- to see if we are on the same page. I respect your work on this project, but you have avoided answering many of my questions, quite consistently. This is not a good way to communicate. I'm not happy with this dynamic, and I'm not interested in discussions that continue in such a fashion. |
Okay, let me answer your questions then.
Yes.
Yes.
Yes.
No, please elaborate.
No, please elaborate. |
This conversation has went off the rails a bit. I'm going to close and lock this with a short summary:
@xpe This is not a direct priority for me however. If you would like to assist us here, we would certainly appreciate a PR that improves the prompt to how |
I press
Y
and then get, on a new line:(Note the
Y/n
instead ofn/Y
)I press
Y
and then get the previous. Repeat ad-infinitum.I eventually press
CTRL-C
to bail. I get back to the terminal, but I've lost my cursor.The text was updated successfully, but these errors were encountered: