1
Fork 0

Also allow forcing pull, even when no images found

This commit is contained in:
Jake Howard 2020-10-05 21:35:15 +01:00
parent afaff012b4
commit 959921bf5f
Signed by: jake
GPG Key ID: 57AFB45680EDD477
1 changed files with 6 additions and 3 deletions

View File

@ -18,6 +18,9 @@ struct Opt {
#[structopt(long)] #[structopt(long)]
force_cycle: bool, force_cycle: bool,
#[structopt(long)]
force_pull: bool,
} }
fn get_files(files: &[String]) -> Option<Vec<PathBuf>> { fn get_files(files: &[String]) -> Option<Vec<PathBuf>> {
@ -35,10 +38,10 @@ fn get_files(files: &[String]) -> Option<Vec<PathBuf>> {
Some(all_files) Some(all_files)
} }
fn do_update(compose_project: compose::ComposeProject, force_cycle: bool) { fn do_update(compose_project: compose::ComposeProject, force_cycle: bool, force_pull: bool) {
info!("Processing {}...", compose_project); info!("Processing {}...", compose_project);
let pre_images = compose_project.get_images(); let pre_images = compose_project.get_images();
if pre_images.is_empty() { if pre_images.is_empty() && !force_pull {
warn!("no running images, skipping"); warn!("no running images, skipping");
return; return;
} }
@ -89,6 +92,6 @@ fn main() {
info!("Found {} projects", compose_projects.len()); info!("Found {} projects", compose_projects.len());
for compose_project in compose_projects { for compose_project in compose_projects {
do_update(compose_project, opts.force_cycle); do_update(compose_project, opts.force_cycle, opts.force_pull);
} }
} }