Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Use blessings to retrieve the width of the terminal.

  • Loading branch information...
commit 4e61815bd1f942cf438b20055742abfee8028e97 1 parent 5ac9840
@JNRowe authored
Showing with 2 additions and 20 deletions.
  1. +2 −1  hubugs/template.py
  2. +0 −11 hubugs/utils.py
  3. +0 −8 tests/test_utils.py
View
3  hubugs/template.py
@@ -195,7 +195,8 @@ def display_bugs(bugs, order, **extras):
bugs = sorted(bugs, key=operator.attrgetter(attr))
- columns = utils.get_term_size().columns
+ # Default to 80 columns, when stdout is not a tty
+ columns = utils.T.width if utils.T.width else 80
template = get_template('view', 'list.txt')
View
11 hubugs/utils.py
@@ -22,7 +22,6 @@
import re
import subprocess
-from collections import namedtuple
from functools import partial
import argh
@@ -207,16 +206,6 @@ def get_repo():
raise RepoError("Unknown project, specify with `--project' option")
-def get_term_size():
- """Fetch the current terminal size
-
- :rtype: ``namedtuple``
- :return: Number of lines and columns in current terminal
- """
- lines, columns = map(int, check_output(["stty", "size"]).split())
- return namedtuple('Tty', 'lines columns')(lines, columns)
-
-
def setup_environment(args):
"""Configure execution environment for commands dispatch
View
8 tests/test_utils.py
@@ -217,14 +217,6 @@ def test_invalid_url(self, get_git_config_val):
utils.get_repo()
-@patch('hubugs.utils.check_output')
-def test_get_term_size(check_output):
- check_output.return_value = '62 118'
- term = utils.get_term_size()
- assert_equals(term.lines, 62)
- assert_equals(term.columns, 118)
-
-
class SetApi(TestCase):
class API_Object():
json = {}
Please sign in to comment.
Something went wrong with that request. Please try again.