diff options
author | Danila Hanchar <d_hanchar@wargaming.net> | 2018-05-18 06:46:37 +0300 |
---|---|---|
committer | Danila Hanchar <d_hanchar@wargaming.net> | 2018-05-18 06:46:37 +0300 |
commit | ad91a6ed45f37e678c48cd205bc8d4e2b52f0df9 (patch) | |
tree | 7b6be1eb0d5eb563bc1edd4926d1022e0481d129 | |
parent | c9146862440fb6a58c7efc8d9a483f2359feabad (diff) | |
download | click-ad91a6ed45f37e678c48cd205bc8d4e2b52f0df9.tar.gz |
path validation bug
-rw-r--r-- | click/termui.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/click/termui.py b/click/termui.py index 98bf6bd..70eaceb 100644 --- a/click/termui.py +++ b/click/termui.py @@ -8,7 +8,7 @@ from ._compat import raw_input, text_type, string_types, \ isatty, strip_ansi, get_winterm_size, DEFAULT_COLUMNS, WIN from .utils import echo from .exceptions import Abort, UsageError -from .types import convert_type, Choice +from .types import convert_type, Choice, Path from .globals import resolve_color_default @@ -116,10 +116,11 @@ def prompt(text, default=None, hide_input=False, confirmation_prompt=False, value = prompt_func(prompt) if value: break - # If a default is set and used, then the confirmation - # prompt is always skipped because that's the only thing - # that really makes sense. elif default is not None: + if isinstance(value_proc, Path): + # validate Path default value(exists, dir_okay etc.) + value = default + break return default try: result = value_proc(value) |