mirror of
https://github.com/borgbackup/borg.git
synced 2024-12-25 09:19:31 +00:00
move defaults up in alternate implementation, use nameduple
This commit is contained in:
parent
158e6b529a
commit
f48bbc3725
1 changed files with 4 additions and 3 deletions
|
@ -11,8 +11,9 @@
|
|||
try:
|
||||
from shutil import get_terminal_size
|
||||
except ImportError:
|
||||
def get_terminal_size(fallback):
|
||||
return (os.environ.get('COLUMNS', fallback[0]), os.environ.get('LINES', fallback[1]))
|
||||
def get_terminal_size(fallback=(80, 24)):
|
||||
TerminalSize = namedtuple(TerminalSize, ['columns', 'lines'])
|
||||
return TerminalSize(os.environ.get('COLUMNS', int(fallback[0])), os.environ.get('LINES', int(fallback[1])))
|
||||
import sys
|
||||
import time
|
||||
import unicodedata
|
||||
|
@ -186,7 +187,7 @@ def csize_fmt(self):
|
|||
return format_file_size(self.csize)
|
||||
|
||||
def show_progress(self, item=None, final=False, stream=None):
|
||||
(columns, lines) = get_terminal_size((80, 24))
|
||||
columns, lines = get_terminal_size()
|
||||
if not final:
|
||||
msg = '{0.osize_fmt} O {0.csize_fmt} C {0.usize_fmt} D {0.nfiles} N '.format(self)
|
||||
path = remove_surrogates(item[b'path']) if item else ''
|
||||
|
|
Loading…
Reference in a new issue