Prompts for a 'yes' or 'no' to given prompt.
179813
def _confirm_dialog(self, prompt):
        '''  '''
        response = raw_input(prompt).strip().lower()
        valid = {'y': True, 'ye': True, 'yes': True, 'n': False, 'no': False}
        while True:
            try:
                return valid[response]
            except:
                response = raw_input("Please respond 'y' or 'n': ").strip().lower()
1037337
public boolean askBoolean(final String question) {
    checkNotNull(question);
    log.trace("Ask boolean; question={}", question);
    String result = readLine(String.format("%s (yes/no): ", question));
    return result.equalsIgnoreCase("yes");
  }
137880
def yn_choice(message, default='y', tries=None):
    
    # http://stackoverflow.com/questions/3041986/python-command-line-yes-no-input"""
    choices = 'Y/n' if default.lower() in ('y', 'yes') else 'y/N'
    if tries is None:
        choice = input("%s (%s) " % (message, choices))
        values = ('y', 'yes', '') if default == 'y' else ('y', 'yes')
        return True if choice.strip().lower() in values else False
    else:
        while tries > 0:
            choice = input(
                "%s (%s) (%s)" % (message, choices, "'q' to discard"))
            choice = choice.strip().lower()
            if choice in ['y', 'yes']:
                return True
            elif choice in ['n', 'no', 'q']:
                return False
            else:
                print("Invalid input...")
                tries -= 1
210049
function askConfirmation(args) {
  let userAnswer = 'no-answer';
  const merged = merge(DEFAULTS.CONFIRMATIONS, args);
  inquirer.prompt([
    {
      type: DEFAULTS.QUESTION_TYPES.CONFIRM,
      name: 'choice',
      message: merged.question,
      default: merged.defaultValue
    }
  ]).then((answer) => {
    userAnswer = answer.choice;
  });
  while (userAnswer === 'no-answer') {
    wait(100);
  }
  return userAnswer;
}
194459
def choice(opts, default=1, text='Please make a choice.'):
    
    opts_len = len(opts)
    opts_enum = enumerate(opts, 1)
    opts = list(opts)

    for key, opt in opts_enum:
        click.echo('[{k}] {o}'.format(k=key, o=opt[1] if isinstance(opt, tuple) else opt))

    click.echo('-' * 12)
    opt = click.prompt(text, default, type=click.IntRange(1, opts_len))
    opt = opts[opt - 1]
    return opt[0] if isinstance(opt, tuple) else opt
113859
def yes_no_query(question):
    

    print("{} (y/n)".format(question), end=" "),
    while True:
        try:
            return strtobool(input().lower())
        except ValueError:
            print("Please respond with 'y' or 'n'.")
1231032
def boolean_input(self, question, default=None):
        '''
        
        '''
        result = input("%s: " % question)
        if not result and default is not None:
            return default
        while len(result) < 1 or result[0].lower() not in "yn":
            result = input("Please answer yes or no: ")
        return result[0].lower() == "y"
648339
function(){
		_prompt.question("You entered '" + _destination + "'. Is this correct? (Y/N)\n", function(input){
			var response = input.trim().toLowerCase();
			evaluateConfirmation(response);
		});
	}
210487
def prompt_for_value(self, ctx):
        
        # Calculate the default before prompting anything to be stable.
        default = self.get_default(ctx)

        # If this is a prompt for a flag we need to handle this
        # differently.
        if self.is_bool_flag:
            return confirm(self.prompt, default)

        return prompt(self.prompt, default=default, type=self.type,
                      hide_input=self.hide_input, show_choices=self.show_choices,
                      confirmation_prompt=self.confirmation_prompt,
                      value_proc=lambda x: self.process_value(ctx, x))
784252
def are_you_sure(msg=''):
    
    """
    print(msg)
    from utool import util_arg
    from utool import util_str
    override = util_arg.get_argflag(('--yes', '--y', '-y'))
    if override:
        print('accepting based on command line flag')
        return True
    valid_ans = ['yes', 'y']
    valid_prompt = util_str.conj_phrase(valid_ans, 'or')
    ans = input('Are you sure?\n Enter %s to accept\n' % valid_prompt)
    return ans.lower() in valid_ans
696359
def yes_or_no(message):
    """"""
    while True:
        print message, '(yes/no)',
        line = raw_input()
        if line is None:
            return None
        line = line.lower()
        if line == 'y' or line == 'ye' or line == 'yes':
            return True
        if line == 'n' or line == 'no':
            return False
604660
def confirm?(msg)
      return true if options[:yes]
      unless STDOUT.isatty
        say(msg)
        return false
      end
      yes?(msg)
    end
928148
def make_dynamic_prompt(self, prompt):
        """"""
        if prompt:
            self.prompt_re = self.driver.make_dynamic_prompt(prompt)
1360423
def for_prompt(cls, **kw):
        
        kw.setdefault('enable_abort_and_exit_bindings', True)
        kw.setdefault('enable_search', True)
        kw.setdefault('enable_auto_suggest_bindings', True)

        return cls(**kw)
1088973
def ask(prompt = '(y/n)')
      command_line.set_prompt prompt
      command_line.refresh
      while (c = Curses.getch)
        next unless [?N, ?Y, ?n, ?y, 3, 27] .include? c  # N, Y, n, y, ^c, esc
        command_line.clear
        command_line.noutrefresh
        break (c == 'y') || (c == 'Y')
      end
    end
1171580
function prompt (data, key, prompt, done) {
  // skip prompts whose when condition is not met
  if (prompt.when && !evaluate(prompt.when, data)) {
    return done()
  }

  var promptDefault = prompt.default
  if (typeof prompt.default === 'function') {
    promptDefault = function () {
      return prompt.default.bind(this)(data)
    }
  }

  inquirer.prompt([{
    type: promptMapping[prompt.type] || prompt.type,
    name: key,
    message: prompt.message || prompt.label || key,
    default: promptDefault,
    choices: prompt.choices || [],
    validate: prompt.validate || function () { return true }
  }], function (answers) {
    if (Array.isArray(answers[key])) {
      data[key] = {}
      answers[key].forEach(function (multiChoiceAnswer) {
        data[key][multiChoiceAnswer] = true
      })
    } else if (typeof answers[key] === 'string') {
      data[key] = answers[key].replace(/"/g, '\\"')
    } else {
      data[key] = answers[key]
    }
    done()
  })
}
602078
def prompt_stdin(prompt):
    """"""
    # raw_input returns the empty string for "enter"
    yes = set(['yes', 'y'])
    no = set(['no','n'])

    try:
        print(prompt)
        if sys.version_info>=(3,0):
            choice = input().lower()
        else:
            choice = raw_input().lower()
        # would like to test for which exceptions here
    except:
        print('Stdin is not implemented.')
        print('You need to set')
        print('overide_manual_authorize=True')
        print('to proceed with the download. Please set that variable and continue.')
        raise


    if choice in yes:
        return True
    elif choice in no:
        return False
    else:
        print("Your response was a " + choice)
        print("Please respond with 'yes', 'y' or 'no', 'n'")