Support for Borg create & prune --stats via borgmatic command-line flag (#100) #115
No reviewers
Labels
No Label
bug
data loss
design finalized
good first issue
new feature area
question / support
security
waiting for response
No Milestone
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: borgmatic-collective/borgmatic#115
Loading…
Reference in New Issue
No description provided.
Delete Branch ":stats"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
i think this should fix the issue
Thank you for taking this on and sending a PR! I appreciate it.
@ -105,6 +105,7 @@ def create_archive(
local_path='borg',
remote_path=None,
progress=False,
stats=False,
I think there's a minor edge case here where, if you specify
borgmatic --create --stats --dry-run
, Borg will explode. (--stats
and--dry-run
are not compatible, at least for--create
.) See a few lines up in this file, where this is handled:One way to deal with this for the new case would be just to disallow it explicitly.. For instance in your argument validation code in
commands/borgmatic.py
.@ -153,6 +154,7 @@ def create_archive(
+ (('--debug', '--show-rc') if logger.isEnabledFor(logging.DEBUG) else ())
+ (('--dry-run',) if dry_run else ())
+ (('--progress',) if progress else ())
+ (('--stats',) if stats else ())
For this change in
prune.py
and the one increate.py
, it looks like--stats
will be passed to Borg twice in the case of any verbosity levels other than zero, because level 1 and 2 already pass in--stats
. That won't break anything, but it does strike me as a little specific to add a whole borgmatic--stats
parameter that's really only there for modifying the--verbosity 0
level. So what do you think of just making--verbosity 0
include--stats
all the time without needing to specify it on borgmatic's command-line?If we do that, then the next logical step, as much as it pains me to suggest it, would be to add a
--verbosity -1
(corresponding to Python'slogging.ERROR
) that would be utterly silent and not include--stats
. And then maybe that could even be the new default if no--verbosity
is specified, so as to avoid actually changing the default behavior for users who are not specifying a--verbosity
.What do you think.. Am I overthinking this?
Would fit my needs, but for people knowing borg and switching to borgmatic. Maybe they would be confused having different args.
This is why I prefer having a seperate arg for it.
Okay. A related idea is to make the default verbosity pass
--stats
to Borg automatically (so presumably that's--verbosity 0
). That way, the user doesn't need to specify--stats
on the borgmatic command-line or even specify--verbosity
to go get that stats output.sounds fine to me. but does a seperate arg hurt this much?
maybe you could have a second look on my commits.
Okay, I'll have a look when I get a chance and keep an open mind. I'm always trying to think hard about each new introduced command-line option and whether it's necessary. But I just added four more today so maybe I need to ease up. :)
Why do you try to minimize the amount of cmd-line options?
I see borgmatic as a wrapper to eliminate the repo location. Which works perfectly.
@ -88,0 +90,4 @@
dest='stats',
default=False,
action='store_true',
help='Display status with --create or --prune option for each file as it is backed up',
Is this description correct? Maybe "status" -> "stats"? And the statistics are displayed at the end rather than as each file is backed up, right?
copy-paste error
any updates, how we are continuing?
Just in the spirit of minimalism and a simple user experience. If
borgmatic --help
is several pages long, that can be overwhelming and make the tool harder to use.But I think you've sold me on the value of
--stats
outweighing that concern here, especially for just one extra command-line flag.I'll merge shortly. Please feel free to add yourself to the
AUTHORS
file if you like.keep the good work up. really appreciate all you have done.
👍