diff options
author | Justin Wernick <justin@worthe-it.co.za> | 2023-07-14 13:13:11 +0200 |
---|---|---|
committer | Justin Wernick <justin@worthe-it.co.za> | 2023-07-14 13:13:11 +0200 |
commit | 755e28d044aaff9a8aa0fa4700105564726ec33d (patch) | |
tree | 45eb98e20c340fc203737843cf43f766026d0c72 /src/lib.rs | |
parent | 58664db6007920939d94977cc7382a5709b16558 (diff) |
Add a housekeeping task, which does git gc
Diffstat (limited to 'src/lib.rs')
-rw-r--r-- | src/lib.rs | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -63,6 +63,25 @@ pub fn run_command(user_input: &str) -> Result<ControlFlow<(), ()>, ShackleError git::delete(&directory)?; println!("Successfully deleted \"{}\"", directory.display()); } + Ok(ShackleCommand::Housekeeping(HousekeepingArgs { directory })) => match directory { + Some(directory) => { + git::housekeeping(&directory)?; + println!( + "Successfully did housekeeping on \"{}\"", + directory.display() + ); + } + None => { + let list = git::list()?; + for repo in list { + git::housekeeping(&repo.path)?; + println!( + "Successfully did housekeeping on \"{}\"", + repo.path.display() + ); + } + } + }, Ok(ShackleCommand::GitUploadPack(upload_pack_args)) => { git::upload_pack(&upload_pack_args)?; } |