diff --git a/src/borg/archiver.py b/src/borg/archiver.py index b8e0e8b2c..61e38c16b 100644 --- a/src/borg/archiver.py +++ b/src/borg/archiver.py @@ -2620,7 +2620,7 @@ class Archiver: help="""specify format for file listing (default: "{mode} {user:6} {group:6} {size:8d} {isomtime} {path}{extra}{NL}")""") subparser.add_argument('--json', action='store_true', - help='Only valid for listing archives. Format output as JSON. ' + help='Only valid for listing repository contents. Format output as JSON. ' 'The form of --format is ignored, ' 'but keys used in it are added to the JSON output. ' 'Some keys are always present. Note: JSON can only represent text. ' diff --git a/src/borg/testsuite/archiver.py b/src/borg/testsuite/archiver.py index 63bb4c00b..9ee4523c7 100644 --- a/src/borg/testsuite/archiver.py +++ b/src/borg/testsuite/archiver.py @@ -1629,11 +1629,15 @@ class ArchiverTestCase(ArchiverTestCaseBase): assert file1['path'] == 'input/file1' assert file1['sha256'] == 'b2915eb69f260d8d3c25249195f2c8f4f716ea82ec760ae929732c0262442b2b' + def test_list_json_args(self): + self.cmd('init', '--encryption=repokey', self.repository_location) + self.cmd('list', '--json-lines', self.repository_location, exit_code=2) + self.cmd('list', '--json', self.repository_location + '::archive', exit_code=2) + def test_log_json(self): self.create_test_files() self.cmd('init', '--encryption=repokey', self.repository_location) log = self.cmd('create', '--log-json', self.repository_location + '::test', 'input', '--list', '--debug') - print(log) messages = {} # type -> message, one of each kind for line in log.splitlines(): msg = json.loads(line)