Skip to content

Instantly share code, notes, and snippets.

@jperry
Last active December 15, 2015 12:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jperry/5257818 to your computer and use it in GitHub Desktop.
Save jperry/5257818 to your computer and use it in GitHub Desktop.
def prompt_user(question, input=STDIN, output=STDOUT)
  console = HighLine.new(input, output)
  console.agree("<%= color('#{question}', GREEN) %>")
end
# Want to override the input based on say an environment variable,
# is the code below an ugly approach?
def prompt_user(question, input=STDIN, output=STDOUT)
  ENV['YES_TO_ALL'] && input = String.new('yes')
  console = HighLine.new(input, output)
  console.agree("<%= color('#{question}', GREEN) %>")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment