-
Notifications
You must be signed in to change notification settings - Fork 14
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
Always use default value when stdin is pipe. #6
Comments
This is a vexing issue. I've merged #8 for now. This is what happens when stdin is not connected to the tty, it is considered as "not interactive" and uses the default value not the piped value. Yes, as you say, I don't also think this is an intuitive behavior. However, in the first place, I don't think it's a good idea to give the value to prompt via a pipe. Prompts should only be used to interact with the user, and if you want to give input from stdin, you should take care of that in some other way. For example, you could do the following
|
I mostly agree. I think it's good to have a dedicated option for testing as suggested, but it can be a bit confusing for normal use. |
Hi! Songmu san!
Yattemasuka???
I have happened that always use default value when stdin is pipe.
% go run /tmp/main.go example (yes/no) [no]: yes say yes % yes | go run /tmp/main.go example (yes/no) [no]: %
I think that the cause is like the code below.
https://github.com/Songmu/prompter/blob/master/prompter.go#L67
So I want to ask, what is the intention of this code? I want to discuss the amendment policy.
こんにちは!
prompter便利に利用させてもらってます!最高です!
darwinでの利用時にpipeだと常にデフォルトバリューが利用されるようで、yesコマンドが上手くう使えないので、上記の箇所のもとの意図を聞きたいです。
The text was updated successfully, but these errors were encountered: