add support for --list --json
#74
|
@ -1,7 +1,5 @@
|
||||||
import logging
|
import logging
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
|
||||||
import tempfile
|
|
||||||
|
|
||||||
from borgmatic.verbosity import VERBOSITY_SOME, VERBOSITY_LOTS
|
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))
|
logger.debug(' '.join(full_command))
|
||||||
|
|
||||||
with tempfile.TemporaryFile() as f_output:
|
output = subprocess.check_output(full_command)
|
||||||
subprocess.check_call(full_command, stdout=f_output)
|
return output.decode() if output is not None else None
|
||||||
f_output.seek(0)
|
|
||||||
return f_output.read().decode()
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ from borgmatic.verbosity import VERBOSITY_SOME, VERBOSITY_LOTS
|
||||||
|
|
||||||
def insert_subprocess_mock(check_call_command, **kwargs):
|
def insert_subprocess_mock(check_call_command, **kwargs):
|
||||||
subprocess = flexmock(module.subprocess)
|
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')
|
LIST_COMMAND = ('borg', 'list', 'repo')
|
||||||
|
|
Loading…
Reference in New Issue
Block a user