KenKundert / emborg

Interactive command line interface to Borg Backup
GNU General Public License v3.0
94 stars 8 forks source link

Is there a way to pass '--stats' to prune during emborg create? #28

Closed alexmitchell closed 4 years ago

alexmitchell commented 4 years ago

I would like to automatically pass '--stats' to the prune function when I run 'emborg -v --narrate create' with prune_after_create enabled in the settings file. I like to see what emborg and borg are doing (though '--list' for prune might be too much info). I would guess that the easiest way might be to change the default behaviour of verbose to include stats for prune. But I don't know it that is true, how to do it myself, or if others would appreciate that default behaviour.

KenKundert commented 4 years ago

What is your desired use-model? Do you want to be able to configure emborg so that:

  1. it always shows the statistics whenever you do a create, or
  2. that the stats be saved to the logfile so you can get them when you need them, or
  3. do you want to request the stats on a specific run, or
  4. are you thinking of something else?
alexmitchell commented 4 years ago

Case 1. Though I would be okay with 2 or 3 instead too.

I mostly want to be alerted somehow when archives are deleted and also be aware of the total size of my archive.

KenKundert commented 4 years ago

Okay, I have this implemented, but I am in the middle of some big changes so it is going to take a bit for it to become available; perhaps a week or two. I have added the --stats option to the create, delete, and prune commands, so you can request the stats on a specific run (case 3). I also added the show_stats setting, so you can configure Emborg to always output the stats (case 1). And finally, if you do not request the stats, they will be saved into the log file so you can find them if you later decide you want them (case 2).

alexmitchell commented 4 years ago

Okay wonderful, thank you.

KenKundert commented 4 years ago

I have updated Emborg on github to version 1.14.5. With this version the create, delete and prune commands now take --stats command line argument. For example:

    emborg create --stats

In addition, Emborg also takes a show_stats setting that causes Emborg to show the stats every time one of these commands is run. Just add:

    show_stats = True

to your settings file. Finally, if you do not explicitly ask for stats using --stats or show_stats, then the stats are captured in the log file and you can run emborg log to see them.

This was a relatively small change, but I made it while doing a substantial refactoring of the code to support Borg patterns. Be careful with this version. Keep an eye on it and make sure it working as expected. Once I am confident that this new version is stable I will upload it to pypi, but that may take some time.

-Ken