Misleading arg name: borgmatic prune --files runs borg prune --list #571

Closed
opened 2022-08-09 08:55:24 +00:00 by real-or-random · 6 comments

What I'm trying to do and why

borg prune has a --list argument that makes borg show the list of pruned/kept archives, see https://borgbackup.readthedocs.io/en/1.1.18/usage/prune.html. This is very helpful together with --dry-run, after modifying the "keep" rules.

Steps to reproduce (if a bug)

borgmatic prune --list

Actual behavior (if a bug)

borgmatic runs action "prune" and "list"

Expected behavior (if a bug)

borgmatic passes --list option to borg
(Well, let's call it "preferred" behavior instead.)

Other notes / implementation ideas

This is tough. Maybe it's finally time to drop the old -- actions, maybe for Borg 2.

Workaround:

extra_borg_options:
    prune: --list

One could probably even use --override but yeah, it's not elegant.

#### What I'm trying to do and why borg prune has a `--list` argument that makes borg show the list of pruned/kept archives, see https://borgbackup.readthedocs.io/en/1.1.18/usage/prune.html. This is very helpful together with `--dry-run`, after modifying the "keep" rules. #### Steps to reproduce (if a bug) `borgmatic prune --list` #### Actual behavior (if a bug) borgmatic runs action "prune" and "list" #### Expected behavior (if a bug) borgmatic passes `--list` option to borg (Well, let's call it "preferred" behavior instead.) #### Other notes / implementation ideas This is tough. Maybe it's finally time to drop the old `--` actions, maybe for Borg 2. Workaround: ``` extra_borg_options: prune: --list ``` One could probably even use `--override` but yeah, it's not elegant.
Author

Just noticed that borg create has also --list but apparently we cover this via verbosity. Related: #195

Ah no, so borgmatic create --files results in borg --list.

According to the code in https://projects.torsion.org/borgmatic-collective/borgmatic/src/branch/master/borgmatic/borg/prune.py#L64 , the same works for prune but calling it --files` doesn't make a lot of sense here.

It's very confusing.

Maybe it's finally time to drop the old -- actions, maybe for Borg 2.

I tend to believe that this is the cleanest approach.

Just noticed that `borg create` has also `--list` but apparently we cover this via verbosity. Related: https://projects.torsion.org/borgmatic-collective/borgmatic/issues/195 Ah no, so `borgmatic create --files` results in `borg --list`. According to the code in https://projects.torsion.org/borgmatic-collective/borgmatic/src/branch/master/borgmatic/borg/prune.py#L64 , the same works for prune but calling it --files` doesn't make a lot of sense here. It's very confusing. > Maybe it's finally time to drop the old -- actions, maybe for Borg 2. I tend to believe that this is the cleanest approach.
real-or-random changed title from No way to run `borg prune --list` to Misleading arg name: `borgmatic prune --files` runs `borg prune --list` 2022-08-09 13:06:53 +00:00
Owner

Okay, so just to make sure I understand, you've identified at least two potential problems with borgmatic's current behavior:

1.--list is an alias for the borgmatic list action rather than actually passing --list to Borg, which is unexpected.
2. You don't want to use --files but would rather use --list.

The first point, I totally get. The UX principle of least surprise and everything.

On point 2, the intent with --files is that (for create), it does more than just --list, it also passes a --filter argument to Borg so that it doesn't show all file types by default.

So is that behavior you don't want/expect? Or is it more that you expect borgmatic to support all/most Borg parameters? It certainly doesn't in all cases, although I guess you could make an argument this is one that should be supported.

Maybe it's finally time to drop the old -- actions, maybe for Borg 2

I'd be open to that, although borgmatic won't necessarily need to make breaking changes to support Borg 2. Related: #557.

Okay, so just to make sure I understand, you've identified at least two potential problems with borgmatic's current behavior: 1.`--list` is an alias for the `borgmatic list` action rather than actually passing `--list` to Borg, which is unexpected. 2. You don't want to use `--files` but would rather use `--list`. The first point, I totally get. The UX principle of least surprise and everything. On point 2, the intent with `--files` is that (for `create`), it does *more* than just `--list`, it also passes a `--filter` argument to Borg so that it doesn't show all file types by default. So is that behavior you don't want/expect? Or is it more that you expect borgmatic to support all/most Borg parameters? It certainly doesn't in all cases, although I guess you could make an argument this is one that should be supported. > Maybe it's finally time to drop the old -- actions, maybe for Borg 2 I'd be open to that, although borgmatic won't _necessarily_ need to make breaking changes to support Borg 2. Related: #557.
Author

On point 2, the intent with --files is that (for create), it does more than just --list, it also passes a --filter argument to Borg so that it doesn't show all file types by default.

Ah no, I think you're misunderstanding my point 2. --files totally makes sense for create.

However, not only create accepts --files but also prune. And this is a way to invoke borg prune --list (at least from looking at the code, I haven't tried it). But this is nonsense. borg prune --list lists archives, not files.

It certainly doesn't in all cases, although I guess you could make an argument this is one that should be supported.

Yes, I think this would be nice to have yes, it's indepedent of the two points I raise here.

> On point 2, the intent with `--files` is that (for `create`), it does *more* than just `--list`, it also passes a `--filter` argument to Borg so that it doesn't show all file types by default. > Ah no, I think you're misunderstanding my point 2. `--files` totally makes sense *for `create`*. However, not only `create` accepts `--files` but also `prune`. And this is a way to invoke `borg prune --list` (at least from looking at the code, I haven't tried it). But this is nonsense. `borg prune --list` lists archives, not files. > It certainly doesn't in all cases, although I guess you could make an argument this is one that should be supported. Yes, I think this would be nice to have yes, it's indepedent of the two points I raise here.
Owner

Done in master and will be part of the next release. Here are the changes:

  • BREAKING: Remove old-style command-line action flags like "--create, "--list", etc.
  • BREAKING: Rename "--files" flag on "prune" action to "--list".
  • Add "--list" as alias for "--files" flag on "create" and "export-tar" actions.

Thanks for suggesting this!

Done in master and will be part of the next release. Here are the changes: * BREAKING: Remove old-style command-line action flags like "--create, "--list", etc. * BREAKING: Rename "--files" flag on "prune" action to "--list". * Add "--list" as alias for "--files" flag on "create" and "export-tar" actions. Thanks for suggesting this!
Owner

Just released in borgmatic 1.7.0!

Just released in borgmatic 1.7.0!
Author

Awesome, thanks! Let's hope it won't break too many old configs. ;)

Awesome, thanks! Let's hope it won't break too many old configs. ;)
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: borgmatic-collective/borgmatic#571
No description provided.