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

Can it support pipe line input ? echo "pipeinput" | ./readline-cli #62

Closed
johnwmail opened this issue Jun 12, 2024 · 6 comments
Closed

Comments

@johnwmail
Copy link

image

@slingamn
Copy link
Member

What is the question exactly? Your screenshot seems to show readline working as expected with non-terminal input.

@wader
Copy link
Collaborator

wader commented Jun 14, 2024

I think related to chzyer/readline#234

@slingamn
Copy link
Member

Oh, that makes sense, the ask is for the program to continue executing? expect(1) is the normal workaround for this, it works with both our fork and upstream.

@slingamn
Copy link
Member

#!/usr/bin/expect -f

spawn ./readline-demo
send "pipeinput\n"
interact

produces

$ ./expect-demo 
spawn ./readline-demo
pipeinput
» pipeinput
2024/06/16 05:08:04 you said: "pipeinput"
» 

Integrating this directly into readline is out of scope.

@johnwmail
Copy link
Author

johnwmail commented Jun 17, 2024

image

The golang-cli still existed ....

@johnwmail
Copy link
Author

My golang-cli is will simply call fmt.Scanln and ask the user input login/pass as variable while the cli running.
In the meantime, the cli can either open file, everything work fine,

Until I want make it support either open file or read the pipeline input, the pipeline input break the fmt.Scanln

(like this: echo "filename" | cli or cli -f filename) and while the cli running , it will ask user input login/pass

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants