Closed matthewbga closed 9 years ago
Is it open source? Could you show me the code? I could try to help you. If not, could you point me to the documentation of the API? Could you try to find an open example in bash or something so we could see how it is handling stdin and stdout?
HighLine can be initialized with the input and output parameters.
# No need to require 'highline/import'. Only 'highline'.
require 'highline'
# Use $stderr instead of $stdout to guarantee console output.
cli = HighLine.new($stdin, $stderr)
answer = cli.ask "Did it work?"
puts "You have answered: #{answer}"
This code above assures output even if you use output redirection on command line.
Closing as stale. If @matthewbga has any news for us he may reopen it.
I apologize. Go ahead and close this. It will likely be open source, but I never could get around the matter of STDOUT swallowing the prompt.
I am working on implementing highline within a git credential-helper. Credential-helpers call a program (executable, script, etc.) and take the stdout from that program as the credential string for use in connecting to a git server. The issue I have is that when highline#ask goes to display the prompt, rather than displaying the prompt, git is receiving this as the anticipated stdout from the called program.
How do I show the prompts for username and password without those prompts "bubbling" up to the calling git process via stdout? This must certainly be a common *NIX use case, but I cannot seem to find the answer.