Skip to content

Conversation

@staxfur
Copy link
Collaborator

@staxfur staxfur commented Nov 30, 2021

This PR adds some variations of a y/n style prompt.

Todo:

  • unify blocking + non blocking functions
  • rename blocking to something else
  • use COR
  • fix windows compilation

@staxfur staxfur requested review from certik November 30, 2021 15:54
@staxfur staxfur self-assigned this Nov 30, 2021
@staxfur staxfur added the enhancement New feature or request label Nov 30, 2021
This was linked to issues Nov 30, 2021
@staxfur staxfur mentioned this pull request Nov 30, 2021
@wolfv
Copy link
Member

wolfv commented Nov 30, 2021

Looks really good! I left some questions, I hope you don't mind!

@staxfur staxfur requested a review from wolfv November 30, 2021 17:19
@staxfur
Copy link
Collaborator Author

staxfur commented Nov 30, 2021

This needs some work anyway - MSVC is going crazy out of nowhere just because I included the base.hpp file that includes the platform.hpp file. I think it's something window.h related again or something... Not sure, if I can fix it that easily for now. We have to remove that include anyway to end stuff like this. But I'd suggest to sinish this PR and merge it until I fixed the windows problem seperately.

@staxfur
Copy link
Collaborator Author

staxfur commented Nov 30, 2021

@wolfv do you guys want the prompt to read on non-interactive terminals the input from the stdin? a use case would be:

program | yes # <- send input via standard in

It's already implemented (in theory) in CPP-Terminal, I'd just need to make it available to the prompt function.

@wolfv
Copy link
Member

wolfv commented Nov 30, 2021

Hmm, good question. I think it woudl be nice, yeah, but most of the time in non-interactive mode we just use --always-yes

@staxfur
Copy link
Collaborator Author

staxfur commented Dec 2, 2021

I have tested some fixes for the windows CI in #125 and removing the "platform.hpp" include in the "base.hpp" file fixes all errors (of course that is not a possible fix, as we need it to enable the "raw mode" for capturing input). I'll have to make some bigger changes for fixing this. Originally i planed on fixing that after having the prompt done, but well...

@staxfur
Copy link
Collaborator Author

staxfur commented Dec 4, 2021

This PR is now ready @certik @wolfv. Please review it. I have fixed the windows error with a simple undefine for now. It looks ugly, but i'll have to finish the Platform header in order to fix that properly (which will be my next PR). I have moved adding support for reading the choice from stdin to #146.

@staxfur
Copy link
Collaborator Author

staxfur commented Dec 7, 2021

I have added CTRL+D support. Can you guys test this PR?

@staxfur
Copy link
Collaborator Author

staxfur commented Dec 13, 2021

@certik @wolfv what's the state of this PR?

@staxfur
Copy link
Collaborator Author

staxfur commented Dec 31, 2021

It's been almost a month now. Can you review this PR? @certik @wolfv.

@staxfur
Copy link
Collaborator Author

staxfur commented Feb 1, 2022

So what's the status of this PR?

@staxfur
Copy link
Collaborator Author

staxfur commented Feb 6, 2022

@certik @wolfv

@certik
Copy link
Collaborator

certik commented Feb 6, 2022

Let me review this.

@certik
Copy link
Collaborator

certik commented Feb 6, 2022

It looks fine to me. @wolfv do you think this goes in the right direction? We can always improve upon it once it is merged.

@staxfur
Copy link
Collaborator Author

staxfur commented Feb 19, 2022

It has been two weeks now. @wolfv please review.

@staxfur
Copy link
Collaborator Author

staxfur commented Apr 13, 2022

What about this PR now? @certik @wolfv I would like to merge the other PRs as well some day.

Copy link
Collaborator

@certik certik left a comment

Choose a reason for hiding this comment

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

I think that this is fine.

Overall I don't like including windows header files in our header files, they should be included in cpp file only.

I suggest we merge this and iterate on it in master. And if improvements are needed, we can add them in later.

@certik certik merged commit 4cdcdf1 into jupyter-xeus:master Apr 13, 2022
@staxfur
Copy link
Collaborator Author

staxfur commented Apr 14, 2022

I think that this is fine.

Overall I don't like including windows header files in our header files, they should be included in cpp file only.

I suggest we merge this and iterate on it in master. And if improvements are needed, we can add them in later.

Yes, I notes that already. The problem with the windows header is that It's needed for saving the terminal state. I think that the right way would be to create a custom struct and then move the old terminal state from the struct defined in windows.h and termio.h into a custom one. what do you think about this? @certik

@staxfur staxfur deleted the simple_prompt branch April 14, 2022 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Recommended version Add a Prompt [y/n]

3 participants