mirror of
https://github.com/nvbn/thefuck.git
synced 2025-04-19 09:10:47 +01:00
#414: Install and use win_unicode_console
only on windows
This commit is contained in:
parent
f9aa0e7c6b
commit
0560f4ba8e
5
setup.py
5
setup.py
@ -22,8 +22,9 @@ elif (3, 0) < version < (3, 3):
|
|||||||
|
|
||||||
VERSION = '3.2'
|
VERSION = '3.2'
|
||||||
|
|
||||||
install_requires = ['psutil', 'colorama', 'six', 'decorator', 'win_unicode_console']
|
install_requires = ['psutil', 'colorama', 'six', 'decorator']
|
||||||
extras_require = {':python_version<"3.4"': ['pathlib']}
|
extras_require = {':python_version<"3.4"': ['pathlib'],
|
||||||
|
":sys_platform=='win32'": ['win_unicode_console']}
|
||||||
|
|
||||||
setup(name='thefuck',
|
setup(name='thefuck',
|
||||||
version=VERSION,
|
version=VERSION,
|
||||||
|
@ -2,8 +2,6 @@ from argparse import ArgumentParser
|
|||||||
from warnings import warn
|
from warnings import warn
|
||||||
from pprint import pformat
|
from pprint import pformat
|
||||||
import sys
|
import sys
|
||||||
import win_unicode_console
|
|
||||||
win_unicode_console.enable() #https://github.com/tartley/colorama/issues/32
|
|
||||||
import colorama
|
import colorama
|
||||||
from . import logs, types, shells
|
from . import logs, types, shells
|
||||||
from .conf import settings
|
from .conf import settings
|
||||||
@ -13,9 +11,18 @@ from .utils import get_installation_info
|
|||||||
from .ui import select_command
|
from .ui import select_command
|
||||||
|
|
||||||
|
|
||||||
|
def init_colorama():
|
||||||
|
if sys.platform == 'win32':
|
||||||
|
# https://github.com/tartley/colorama/issues/32
|
||||||
|
import win_unicode_console
|
||||||
|
|
||||||
|
win_unicode_console.enable()
|
||||||
|
colorama.init()
|
||||||
|
|
||||||
|
|
||||||
def fix_command():
|
def fix_command():
|
||||||
"""Fixes previous command. Used when `thefuck` called without arguments."""
|
"""Fixes previous command. Used when `thefuck` called without arguments."""
|
||||||
colorama.init()
|
init_colorama()
|
||||||
settings.init()
|
settings.init()
|
||||||
with logs.debug_time('Total'):
|
with logs.debug_time('Total'):
|
||||||
logs.debug(u'Run with settings: {}'.format(pformat(settings)))
|
logs.debug(u'Run with settings: {}'.format(pformat(settings)))
|
||||||
@ -53,7 +60,7 @@ def how_to_configure_alias():
|
|||||||
It'll be only visible when user type fuck and when alias isn't configured.
|
It'll be only visible when user type fuck and when alias isn't configured.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
colorama.init()
|
init_colorama()
|
||||||
settings.init()
|
settings.init()
|
||||||
logs.how_to_configure_alias(shells.how_to_configure())
|
logs.how_to_configure_alias(shells.how_to_configure())
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ from . import logs
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
import msvcrt
|
import msvcrt
|
||||||
|
|
||||||
def getch():
|
def getch():
|
||||||
ch = msvcrt.getch()
|
ch = msvcrt.getch()
|
||||||
if ch in (b'\x00', b'\xe0'): # arrow or function key prefix?
|
if ch in (b'\x00', b'\xe0'): # arrow or function key prefix?
|
||||||
|
Loading…
x
Reference in New Issue
Block a user