diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2018-06-16 18:23:36 +0900 |
---|---|---|
committer | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2018-06-16 18:23:36 +0900 |
commit | 71c0eb6b1ac07779bfe801469f50d41f5852131e (patch) | |
tree | a7655f6292b7416af91fe5963dd07baf4baac4fa /sphinx/cmd/quickstart.py | |
parent | 0016bccb676e09538e311d2fa1fa6e3c71703955 (diff) | |
parent | 62b6d209dc181978f202172e7338dabfdf21e1f4 (diff) | |
download | sphinx-git-71c0eb6b1ac07779bfe801469f50d41f5852131e.tar.gz |
Merge branch '1.7'
Diffstat (limited to 'sphinx/cmd/quickstart.py')
-rw-r--r-- | sphinx/cmd/quickstart.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/sphinx/cmd/quickstart.py b/sphinx/cmd/quickstart.py index d6c7fa22a..14217d1a7 100644 --- a/sphinx/cmd/quickstart.py +++ b/sphinx/cmd/quickstart.py @@ -41,7 +41,7 @@ from sphinx import __display_version__, package_dir from sphinx.locale import __ from sphinx.util import texescape from sphinx.util.console import ( # type: ignore - purple, bold, red, turquoise, nocolor, color_terminal + colorize, bold, red, turquoise, nocolor, color_terminal ) from sphinx.util.osutil import ensuredir, make_filename from sphinx.util.template import SphinxRenderer @@ -85,8 +85,14 @@ PROMPT_PREFIX = '> ' # function to get input from terminal -- overridden by the test suite def term_input(prompt): # type: (unicode) -> unicode - print(prompt, end='') - return input('') + if sys.platform == 'win32': + # Important: On windows, readline is not enabled by default. In these + # environment, escape sequences have been broken. To avoid the + # problem, quickstart uses ``print()`` to show prompt. + print(prompt, end='') + return input('') + else: + return input(prompt) class ValidationError(Exception): @@ -186,7 +192,7 @@ def do_prompt(text, default=None, validator=nonempty): prompt = prompt.encode('utf-8') except UnicodeEncodeError: prompt = prompt.encode('latin1') - prompt = purple(prompt) + prompt = colorize('purple', prompt, input_mode=True) x = term_input(prompt).strip() if default and not x: x = default |