mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 16:24:40 +04:00
Merge pull request #348 from pre-commit/use_pyterminalsize
Use pyterminalsize for terminal sizing
This commit is contained in:
commit
3b28e8f807
2 changed files with 3 additions and 18 deletions
|
|
@ -1,29 +1,14 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
from backports.shutil_get_terminal_size import get_terminal_size
|
||||
from pyterminalsize import get_terminal_size
|
||||
|
||||
from pre_commit import color
|
||||
from pre_commit import five
|
||||
|
||||
|
||||
def _get_cols_from_tput(): # pragma: no cover (fallback)
|
||||
if not os.environ.get('TERM'):
|
||||
return 80
|
||||
else:
|
||||
return int(
|
||||
subprocess.Popen(
|
||||
('tput', 'cols'), stdout=subprocess.PIPE,
|
||||
).communicate()[0] or
|
||||
# Default in the case of no terminal
|
||||
80
|
||||
)
|
||||
|
||||
|
||||
COLS = get_terminal_size((0, 0)).columns or _get_cols_from_tput()
|
||||
COLS = get_terminal_size((80, 0)).columns
|
||||
|
||||
|
||||
def get_hook_message(
|
||||
|
|
|
|||
2
setup.py
2
setup.py
|
|
@ -41,11 +41,11 @@ setup(
|
|||
install_requires=[
|
||||
'argparse',
|
||||
'aspy.yaml',
|
||||
'backports.shutil_get_terminal_size',
|
||||
'cached-property',
|
||||
'jsonschema',
|
||||
'nodeenv>=0.11.1',
|
||||
'ordereddict',
|
||||
'pyterminalsize',
|
||||
'pyyaml',
|
||||
'virtualenv',
|
||||
],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue