add support for --list --json #74

Merged
witten merged 5 commits from :list-json into master 2018-07-28 21:21:39 +00:00
2 changed files with 3 additions and 7 deletions
Showing only changes of commit 7a4c41c12c - Show all commits

View File

@ -1,7 +1,5 @@
import logging
import subprocess
import sys
import tempfile
from borgmatic.verbosity import VERBOSITY_SOME, VERBOSITY_LOTS
@ -29,7 +27,5 @@ def list_archives(verbosity, repository, storage_config, local_path='borg', remo
logger.debug(' '.join(full_command))
with tempfile.TemporaryFile() as f_output:
subprocess.check_call(full_command, stdout=f_output)
f_output.seek(0)
return f_output.read().decode()
output = subprocess.check_output(full_command)
return output.decode() if output is not None else None

View File

@ -8,7 +8,7 @@ from borgmatic.verbosity import VERBOSITY_SOME, VERBOSITY_LOTS
def insert_subprocess_mock(check_call_command, **kwargs):
subprocess = flexmock(module.subprocess)
subprocess.should_receive('check_call').with_args(check_call_command, stdout=object, **kwargs).once()
subprocess.should_receive('check_output').with_args(check_call_command, **kwargs).once()
LIST_COMMAND = ('borg', 'list', 'repo')