-
Notifications
You must be signed in to change notification settings - Fork 2
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
[Question] How to use the Expect.BufStr()? #7
Comments
@grrtrr I saw that you contributed quite a bit in your fork. Do you have an idea how this could be achieved? |
Not immediately, this is some time ago. Here are some examples, hope they may be of help: grrtrr@7603f50 |
Hi I think you should be looking for a choice line matching inputs like:
Something like this should match a choice line: Do that in a loop till you get "Your choice" |
Hi guys, and thanks for your quick reply. Got a busy week, I couldn't take a look sooner. @leemcloughlin I see what you mean, and it's true that I can make it work this way. But I think it'd be simpler to have a buffer from the last matched expect. Let's look through a more concrete example:
I could totally do this:
but it sounds more natural to me to try to detect first the prompt and use a buffer for the past lines to extract the choices now that I know what I am being asked (which is what we do as human):
What do you think? |
Description
I don't understand how to use the Expect.BufStr().
Let's say I have this command that prints this:
If I write this in my code:
Question
How can I read the choices after the
exp.Expect()
call?Environment
The text was updated successfully, but these errors were encountered: