Viewing File: /opt/alt/python38/lib/python3.8/site-packages/click/__pycache__/termui.cpython-38.pyc
U
e([VR @ s d dl Z d dlZd dlZddlmZmZmZmZmZm Z m
Z
mZ ddlm
Z
ddlmZmZ ddlmZ ddlmZ eZdZd Zd
d Zd2d
dZd3ddZd4ddZdd Zd5ddZd6ddZd d! Zd7d"d#Z d$d% Z!d8d&d'Z"d9d)d*Z#d:d+d,Z$dZ%d;d-d.Z&d<d0d1Z'dS )= N ) raw_input text_typestring_typesisatty
strip_ansiget_winterm_sizeDEFAULT_COLUMNSWIN)echo)Abort
UsageError)convert_type)resolve_color_default) ZblackZredZgreenZyellowZblueZmagentaZcyanZwhiteresetz[0mc C s dd l }| | S )Nr )getpass)promptr r
/termui.pyhidden_prompt_func s r Fc C s$ | }|d k r|rd||f }|| S )Nz%s [%s]r )textsuffixshow_defaultdefaultr r r r
_build_prompt s r : Tc
s d} fdd}
|dkr$t ||}t| |||}|
|}|rBqPq2|dk r2|S q2z||} W n< tk
r }
ztd|
j d W Y q2W 5 d}
~
X Y nX |s| S |
d}|rqq||kr| S td d q2dS )a Prompts a user for input. This is a convenience function that can
be used to prompt a user for input later.
If the user aborts the input by sending a interrupt signal, this
function will catch it and raise a :exc:`Abort` exception.
.. versionadded:: 6.0
Added unicode support for cmd.exe on Windows.
.. versionadded:: 4.0
Added the `err` parameter.
:param text: the text to show for the prompt.
:param default: the default value to use if no input happens. If this
is not given it will prompt until it's aborted.
:param hide_input: if this is set to true then the input value will
be hidden.
:param confirmation_prompt: asks for confirmation for the value.
:param type: the type to use to check the value against.
:param value_proc: if this parameter is provided it's a function that
is invoked instead of the type conversion to
convert a value.
:param prompt_suffix: a suffix that should be added to the prompt.
:param show_default: shows or hides the default value in the prompt.
:param err: if set to true the file defaults to ``stderr`` instead of
``stdout``, the same as with echo.
Nc sX rt p
t}zt| d d |dW S ttfk
rR rHtd d t Y nX d S )NFnlerr r )r visible_prompt_funcr KeyboardInterruptEOFErrorr )r fr
hide_inputr r prompt_funcC s
zprompt.<locals>.prompt_funcz Error: %sr zRepeat for confirmation: z*Error: the two entered values do not match)r r r
r message)r r r&