Add gc command to clean up vault
This commit is contained in:
parent
099cb8d4f7
commit
4e014168b4
2 changed files with 17 additions and 0 deletions
|
|
@ -28,6 +28,8 @@ enum Command {
|
|||
Run,
|
||||
/// Export logs for a single room as a plain text file.
|
||||
Export { room: String, file: PathBuf },
|
||||
/// Compact and clean up vault.
|
||||
Gc,
|
||||
}
|
||||
|
||||
impl Default for Command {
|
||||
|
|
@ -54,6 +56,11 @@ async fn main() -> anyhow::Result<()> {
|
|||
match args.command.unwrap_or_default() {
|
||||
Command::Run => run(&vault).await?,
|
||||
Command::Export { room, file } => export::export(&vault, room, &file).await?,
|
||||
Command::Gc => {
|
||||
println!("Cleaning up and compacting vault");
|
||||
println!("This may take a while...");
|
||||
vault.gc().await;
|
||||
}
|
||||
}
|
||||
|
||||
vault.close().await;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue