Displays a prompt and then reads in private input from System.in.
Characters typed by the user are replaced with a space on the screen.

@param prompt  the prompt to be displayed
@return <code>String</code> the input read in (entered after the prompt)
427255
public static String getPrivateInput(String prompt) {
        System.out.print(prompt);

        PrivateInputThread privateInput = new PrivateInputThread();
        BufferedReader in =
            new BufferedReader(new InputStreamReader(System.in));

        privateInput.start();
        try {
            return in.readLine();
        } catch(Exception e) {
            return null;
        } finally {
            privateInput.kill();
        }
    }
625895
def _PromptUserForInput(self, input_text):
    
    self._output_writer.Write('{0:s}: '.format(input_text))
    return self._input_reader.Read()
456343
def prompt_file(prompt, default=None):
    """"""

    def complete(text: str, state):
        text = text.replace('~', HOME)

        sugg = (glob.glob(text + '*') + [None])[state]

        if sugg is None:
            return

        sugg = sugg.replace(HOME, '~')
        sugg = sugg.replace('\\', '/')

        if os.path.isdir(sugg) and not sugg.endswith('/'):
            sugg += '/'

        return sugg

    readline.set_completer_delims(' \t\n;')
    readline.parse_and_bind("tab: complete")
    readline.set_completer(complete)

    if default is not None:
        r = input('%s [%r]: ' % (prompt, default))
    else:
        r = input('%s: ' % prompt)

    r = r or default

    # remove the autocompletion before quitting for future input()
    readline.parse_and_bind('tab: self-insert')

    return r
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
495995
private char[] readPassword(String description, boolean echoInput) {
        getConsole().print(description + ": ");
        return getConsole().readPassword(echoInput);
    }
480384
def prompt(self):
        """"""
        if self.prompt_string is not None:
            return self.prompt_string

        if not self.color_enabled:
            return (' '.join(self.command) + '>> ').encode('utf8')

        color = '34'
        sub_color = '37'

        prompt_cmd = [
            self.colorize('1;' + color, part) if part != self.cmd_sub_str else
            self.colorize('0;' + sub_color, u'\u2026') for part in self.command
        ]

        return ' '.join(prompt_cmd) + self.colorize('0;' + color, '>> ')
1135150
def _prompt_password(prompt="Password: "):
    """"""
    fd = sys.stdin.fileno()
    old_settings = termios.tcgetattr(fd)
    tty.setraw(fd)

    print(prompt, end="", flush=True)
    password = []
    try:
        while True:
            ch = sys.stdin.buffer.read(1)[0]
            if ch in (ord("\r"), ord("\n"), 4):  # If user presses Enter or ctrl-d
                print("\r")
                break
            elif ch == 127:  # DEL
                try:
                    password.pop()
                except IndexError:
                    pass
                else:
                    print("\b \b", end="", flush=True)
            elif ch == 3:  # ctrl-c
                print("^C", end="", flush=True)
                raise KeyboardInterrupt
            else:
                password.append(ch)
                print("*", end="", flush=True)
    finally:
        termios.tcsetattr(fd, termios.TCSADRAIN, old_settings)

    return bytes(password).decode()
377314
private String promptForText(ConsoleWrapper stdin, PrintStream stdout,
                                 String enterText, String reenterText,
                                 String readError, String entriesDidNotMatch) {
        String read1 = stdin.readMaskedText(getMessage(enterText) + " ");
        String read2 = stdin.readMaskedText(getMessage(reenterText) + " ");
        if (read1 == null && read2 == null) {
            throw new IllegalArgumentException("Unable to read either entry. Aborting prompt.");
        } else if (read1 == null || read2 == null) {
            stdout.println(getMessage(readError));
            return promptForText(stdin, stdout, enterText, reenterText, readError, entriesDidNotMatch);
        } else if (read1.equals(read2)) {
            return read1;
        } else {
            stdout.println(getMessage(entriesDidNotMatch));
            return promptForText(stdin, stdout, enterText, reenterText, readError, entriesDidNotMatch);
        }
    }
1255096
@Cmd
	public String prompt(final String configKey, final String message) {
		System.out.print(resolveProperty(message) + " "); //NOSONAR
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		try {
			String value = StringUtils.trim(in.readLine());
			config.put(configKey, value);
			return value;
			// Stream nicht schliessen
		} catch (IOException ex) {
			throw new IllegalStateException(ex);
		}
	}
249280
def prompt(p, yes_no=false)
      puts #newline for newline's sake!

      loop do
        print p, ' '
        line = STDIN.readline.strip
        if yes_no
          return true if line =~ YES
          return false if line =~ NO
        else
          return line
        end
      end
    end
169657
def _prompt(pre_prompt, items, post_prompt, default, indexed, stream):
    '''
    
    '''
    # try to sub in the default if provided
    if default is not None:
        if '{}' in pre_prompt:
            pre_prompt = pre_prompt.format(default)
        if '{}' in post_prompt:
            post_prompt = post_prompt.format(default)
    # build the item strings
    item_format = "{indent}{item}"
    if indexed:
        item_format = "{indent}[{index}] {item}"
    item_text_list = []
    indent = '  '
    for index, item in enumerate(items):
        item_text = ''
        components = {
            'indent': indent,
            'item': item
        }
        if indexed:
            components['index'] = index
        item_text = item_format.format(**components)
        item_text_list.append(item_text)
    # build full menu
    menu_parts = [pre_prompt] + item_text_list
    full_menu = '\n'.join(menu_parts) + '\n'
    stream.write(full_menu)
    stream.flush()
    # Get user response
    # - py 2/3 compatibility
    get_input = input
    try:
        get_input = raw_input
    except NameError:
        pass
    # - actuall get input
    response = get_input(post_prompt)
    return response
461931
def prompt_for_input(message, input_type=None):
    """"""
    while True:
        output = prompt.query(message)

        if input_type:
            try:
                output = input_type(output)
            except ValueError:
                error_message('Invalid input type')
                continue

        break

    return output
976213
public static function prompt($msg, $password = null)
    {
        // output message
        echo $msg;
        // if password then disable text output
        if ($password != null) {
            system('stty -echo');
        }

        $input = trim(fgets(STDIN));

        if ($password != null) {
            system('stty echo');
            echo PHP_EOL; // output end of line because the user's CR won't have been outputted
        }
        return $input;
    }
779493
def strip_prompt(self, a_string):
        
        response_list = a_string.split(self.RESPONSE_RETURN)
        last_line = response_list[-1]
        if self.base_prompt in last_line:
            return self.RESPONSE_RETURN.join(response_list[:-1])
        else:
            return a_string
842135
private function readline(string $prompt)
    {
        if (PHP_OS == 'WINNT') {
            echo $prompt;
            $line = stream_get_line(STDIN, 1024, PHP_EOL);

        } else {
            $line = readline($prompt);
        }
        return $line;
    }
26748
def _get_input_buffer(self):
        """"""
        input_buffer = ''
        if self.current_prompt_pos is not None:
            input_buffer = self.get_text(self.current_prompt_pos, 'eol')
            input_buffer = input_buffer.replace(os.linesep, '\n')
        return input_buffer
631894
func Prompt(prompt string, defaultValue string) (string, error) {
	fmt.Print(prompt)
	reader := bufio.NewReader(os.Stdin)
	line, err := reader.ReadString('\n')
	if err != nil {
		return defaultValue, err
	}
	line = strings.TrimSpace(line)
	if line == "" {
		return defaultValue, nil
	}
	return line, nil
}