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

added y/n prompt #144

Merged
merged 14 commits into from
Apr 13, 2022
Merged

added y/n prompt #144

merged 14 commits into from
Apr 13, 2022

Conversation

MCWertGaming
Copy link
Collaborator

@MCWertGaming MCWertGaming 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

@MCWertGaming MCWertGaming self-assigned this Nov 30, 2021
@MCWertGaming MCWertGaming added the enhancement New feature or request label Nov 30, 2021
This was linked to issues Nov 30, 2021
@MCWertGaming MCWertGaming 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!

@MCWertGaming
Copy link
Collaborator Author

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.

@MCWertGaming
Copy link
Collaborator Author

MCWertGaming 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

cpp-terminal/prompt.hpp Outdated Show resolved Hide resolved
@MCWertGaming
Copy link
Collaborator Author

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...

@MCWertGaming
Copy link
Collaborator Author

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.

@MCWertGaming MCWertGaming added this to In progress in CPP-Terminal Dec 6, 2021
@MCWertGaming MCWertGaming moved this from In progress to Pull-Requests in CPP-Terminal Dec 6, 2021
@MCWertGaming
Copy link
Collaborator Author

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

@MCWertGaming
Copy link
Collaborator Author

MCWertGaming commented Dec 13, 2021

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

@MCWertGaming
Copy link
Collaborator Author

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

@MCWertGaming
Copy link
Collaborator Author

So what's the status of this PR?

@MCWertGaming
Copy link
Collaborator Author

@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.

@MCWertGaming
Copy link
Collaborator Author

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

@MCWertGaming
Copy link
Collaborator Author

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
CPP-Terminal automation moved this from Pull-Requests to Done Apr 13, 2022
@MCWertGaming
Copy link
Collaborator Author

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

@MCWertGaming MCWertGaming 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