Skip to content

list: hint to use repo-list when no archive NAME is given Refs #9545#9571

Open
charmikadi wants to merge 6 commits into
borgbackup:masterfrom
charmikadi:fix/list-missing-name-hint
Open

list: hint to use repo-list when no archive NAME is given Refs #9545#9571
charmikadi wants to merge 6 commits into
borgbackup:masterfrom
charmikadi:fix/list-missing-name-hint

Conversation

@charmikadi

@charmikadi charmikadi commented Apr 14, 2026

Copy link
Copy Markdown
Contributor

Description

When a user runs borg list without providing a required archive NAME,
they currently get a generic argparse error. This is confusing for users
migrating from borg1 who may expect borg list to list archives in a
repository (which is borg repo-list in borg2).

This change makes the name argument optional at the parser level and
adds an explicit, targeted error message in do_list that explains what
went wrong and suggests the correct command:

Error: borg list requires an archive NAME.
To list the archives in a repository, use: borg repo-list

Refs #9545

Checklist

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

@codecov

codecov Bot commented Apr 14, 2026

Copy link
Copy Markdown

Codecov Report

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

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #9571   +/-   ##
=======================================
  Coverage   84.94%   84.94%           
=======================================
  Files          92       92           
  Lines       15291    15295    +4     
  Branches     2296     2297    +1     
=======================================
+ Hits        12989    12993    +4     
  Misses       1611     1611           
  Partials      691      691           

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

Add test for list command without archive name
Updated error handling in the do_list method to print error message to stderr.
Replace return code with set_ec for error handling.
@charmikadi

Copy link
Copy Markdown
Contributor Author

Just bumping this PR for visibility. It implements issue #9545 (case 8) by adding a clear error message that suggests borg repo-list when borg list is run without an archive NAME.

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.

1 participant