Print MSG and a confirmation prompt.

    Waiting for user's confirmation, unless silent '--yes-i-know'
    command line option was used, in which case the function
    returns immediately without printing anything.
434878
def wait_for_user(msg=""):
    
    if '--yes-i-know' in sys.argv:
        return
    print(msg)
    try:
        answer = raw_input("Please confirm by typing 'Yes, I know!': ")
    except KeyboardInterrupt:
        print()
        answer = ''
    if answer != 'Yes, I know!':
        sys.stderr.write("ERROR: Aborted.\n")
        sys.exit(1)
    return
341878
def prog(self, s=None):
        
        s = s or self.prog_msg
        self.printer(s, end='')
36498
def prompt(prompt_string, default=None, secret=False, boolean=False, bool_type=None):
    
    if boolean or bool_type in BOOLEAN_DEFAULTS:
        if bool_type is None:
            bool_type = 'y_n'
        default_msg = BOOLEAN_DEFAULTS[bool_type][is_affirmative(default)]
    else:
        default_msg = " (default {val}): "
    prompt_string += (default_msg.format(val=default) if default else ": ")
    if secret:
        val = getpass(prompt_string)
    else:
        val = input(prompt_string)
    val = (val if val else default)
    if boolean:
        val = val.lower().startswith('y')
    return val
673871
def _print_help(self):
        """"""
        msg = """Commands (type help <command> for details)

CLI:                     help history exit quit
Session, General:        set load save reset
Session, Access Control: allowaccess denyaccess clearaccess
Session, Replication:    allowrep denyrep preferrep blockrep
                         removerep numberrep clearrep
Read Operations:         get meta list log resolve
Write Operations:        update create package archive
                         updateaccess updatereplication
Utilities:               listformats listnodes search ping
Write Operation Queue:   queue run edit clearqueue

Command History:         Arrow Up, Arrow Down
Command Editing:         Arrow Left, Arrow Right, Delete
        """
        if platform.system() != "Windows":
            msg += """Command Completion:      Single Tab: Complete unique command
                         Double Tab: Display possible commands
            """
        d1_cli.impl.util.print_info(msg)
67182
def result(self, msg, do_reset=False):
        
        result = "%s (%s s)" % (msg, time.time() - self.start)
        if do_reset:
            self.start = time.time()
        return result
1240158
def ask_confirmation(prompt = 'Continue?', default = false)
      a = ''
      s = default ? '[Y/n]' : '[y/N]'
      d = default ? 'y' : 'n'
      until %w[y n].include? a
        a = ask("#{prompt} #{s} ") { |q| q.limit = 1; q.case = :downcase }
        a = d if a.length.zero?
      end
      a == 'y'
    end
135377
def prompt(msg, default=None):
    ""
    if default is not None:
        msg = '{} ({})'.format(msg, repr(default))
    msg = '{}: '.format(msg)
    try:
        s = input(msg)
    except KeyboardInterrupt:
        exit(1)
    except EOFError:
        s = ''
    if not s:
        s = default
    return s
527455
def confirm(*args, **kwargs):
    """"""
    try:
        return click.confirm(*args, **kwargs)
    except click.Abort:
        return False
715534
def terminal(self, confirmation=True):

        '''
            
        '''

        title = '%s.terminal' % self.__class__.__name__

    # construct ssh command
        if confirmation:
            override_cmd = ' '
        else:
            override_cmd = ' -o CheckHostIP=no '
        sys_command = 'ssh -i %s%s%s@%s' % (self.pem_file, override_cmd, self.login_name, self.instance_ip)
        self.ec2.iam.printer(sys_command)

    # send shell script command to open up terminal
        if self.localhost.os.sysname in ('Windows'):
            raise Exception('%s is not supported on Windows. try using putty.exe')
        try:
            import os
            os.system(sys_command)
    # TODO: check into making sys_command OS independent
        except:
            raise AWSConnectionError(title)

        return True
600791
def notify(msg, msg_type=0, t=None):
    msg = msg.replace('"', '\\"')
    ""
    if platform.system() == "Darwin":
        command = notify_command_osx(msg, msg_type, t)
    else:
        command = notify_command_linux(msg, t)

    try:
        subprocess.call(command)
        return True
    except OSError as e:
        return False
1061064
def info(msg, *args, **kw):
    # type: (str, *Any, **Any) -> None
    
    if len(args) or len(kw):
        msg = msg.format(*args, **kw)

    shell.cprint('-- <32>{}<0>'.format(msg))
1019217
def confirm(text='', title='', buttons=[OK_TEXT, CANCEL_TEXT], root=None, timeout=None):
    """"""
    assert TKINTER_IMPORT_SUCCEEDED, 'Tkinter is required for pymsgbox'
    return _buttonbox(msg=text, title=title, choices=[str(b) for b in buttons], root=root, timeout=timeout)
836035
def confirm(prompt, default=None, show_default=True, abort=False, input_function=None):
	'''
	'''
	valid = {
		'yes': True,
		'y': True,
		'no': False,
		'n': False
	}
	input_function = get_input_fn(input_function)
	if default not in ['yes', 'no', None]:
		default = None
	if show_default:
		prompt = '{} [{}/{}]: '.format(prompt,
				'Y' if default == 'yes' else 'y',
				'N' if default == 'no' else 'n')
	while True:
		choice = prompt_fn(input_function, prompt, default).lower()
		if choice in valid:
			if valid[choice] == False and abort:
				raise_abort()
			return valid[choice]
		else:
			echo('Please respond with "yes" or "no" (or "y" or "n").')
452921
def prompt(text, default=None, show_default=True, invisible=False,
           confirm=False, skip=False, type=None, input_function=None):
	'''
	'''
	t = determine_type(type, default)
	input_function = get_input_fn(input_function, invisible)
	if default is not None and show_default:
		text = '{} [{}]: '.format(text, default)
	while True:
		val = prompt_fn(input_function, text, default, t, skip, repeat=True)
		if not confirm or (skip and val is None):
			return val
		if val == prompt_fn(input_function, 'Confirm: ', default, t, repeat=True):
			return val
		echo('Error: The two values you entered do not match', True)
897492
def ask_for_confirm_with_message(cls, ui, prompt='Do you agree?', message='', **options):
        """"""
        return cls.get_appropriate_helper(ui).ask_for_confirm_with_message(prompt, message)
186778
def confirm_operation(prompt, prefix=None, assume_yes=False, err=False):
    """"""
    if assume_yes:
        return True

    prefix = prefix or click.style(
        "Are you %s certain you want to" % (click.style("absolutely", bold=True))
    )

    prompt = "%(prefix)s %(prompt)s?" % {"prefix": prefix, "prompt": prompt}

    if click.confirm(prompt, err=err):
        return True

    click.echo(err=err)
    click.secho("OK, phew! Close call. :-)", fg="green", err=err)
    return False
947846
def signal_handler(sig, frame):
    """"""
    print('\nYou pressed Ctrl+C')
    if board is not None:
        board.send_reset()
        board.shutdown()
    sys.exit(0)