Skip to content

version: add --json output - #9997

Draft
Bondo2-1 wants to merge 1 commit into
borgbackup:masterfrom
Bondo2-1:issue-9993-json-version
Draft

version: add --json output#9997
Bondo2-1 wants to merge 1 commit into
borgbackup:masterfrom
Bondo2-1:issue-9993-json-version

Conversation

@Bondo2-1

@Bondo2-1 Bondo2-1 commented Aug 1, 2026

Copy link
Copy Markdown

Description

Add a --json option to borg version that emits the formatted client and server versions as named fields:

{
    "client": "2.0.0b23",
    "server": "2.0.0b23"
}

The existing text output remains unchanged when --json is not supplied. This gives tooling a stable, machine-readable format and makes borg version consistent with Borg's other status commands.

Focused command tests cover both the existing text format and the new JSON format. The generated usage documentation now includes the new option.

Fixes #9993.

Validation

  • python -m pytest -q src/borg/testsuite/archiver/version_cmd_test.py (2 passed)
  • pre-commit run --files src/borg/archiver/version_cmd.py src/borg/testsuite/archiver/version_cmd_test.py (Black and Ruff passed)
  • python scripts/make.py build_usage
  • borg version --json smoke test

Checklist

  • PR is against master (or maintenance branch if only applicable there)
  • New code has tests and docs where appropriate
  • Tests pass (relevant focused test subset)
  • Commit messages are clean and reference related issues

@codecov

codecov Bot commented Aug 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.81%. Comparing base (a293a67) to head (575f858).
⚠️ Report is 1 commits behind head on master.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #9997      +/-   ##
==========================================
- Coverage   85.88%   85.81%   -0.08%     
==========================================
  Files          95       95              
  Lines       17088    17095       +7     
  Branches     2616     2617       +1     
==========================================
- Hits        14676    14670       -6     
- Misses       1674     1685      +11     
- Partials      738      740       +2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@ThomasWaldmann

ThomasWaldmann commented Aug 1, 2026

Copy link
Copy Markdown
Member

@Bondo2-1 Thanks for the PR!

CI tests are failing on windows still due to the line endings:

E       AssertionError: assert '2.0.0b23 / 2.0.0b23\r\n' == '2.0.0b23 / 2.0.0b23\n'

Other than that, it looks pretty good, so guess you could click "Ready for review" after fixing this (and when you think you are finished with it).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

version: add --json output

2 participants