Skip to content
Snippets Groups Projects
Verified Commit f2936e49 authored by STEVAN Antoine's avatar STEVAN Antoine :crab:
Browse files

refactor

parent 93529e7a
No related branches found
No related tags found
1 merge request!207add `container list` for Docker containers
Pipeline #8416 passed
......@@ -155,17 +155,16 @@ fn main() {
nob::run_cmd_and_fail!("docker", "login", REGISTRY);
nob::run_cmd_and_fail!("docker", "login", MIRROR_REGISTRY);
} else if *list {
let mut cmd_base = vec!["docker", "image", "list", "--format", "json"];
fn extend_and_run (cmd: Vec<&str>, args: &[&str]) -> String {
let mut cmd = cmd.clone();
fn extend_and_run (cmd: &[&str], args: &[&str]) -> String {
let mut cmd = cmd.to_vec();
cmd.extend_from_slice(&args);
String::from_utf8(nob::run_cmd_as_vec_and_fail!(+cmd).stdout).expect("Invalid UTF-8 string")
}
let cmd = vec!["docker", "image", "list", "--format", "json"];
docker_images_to_table(
extend_and_run(cmd_base.clone(), &[&repo]) +
&extend_and_run(cmd_base.clone(), &[&mirror_repo])
extend_and_run(&cmd, &[&repo]) +
&extend_and_run(&cmd, &[&mirror_repo])
).printstd();
} else if *push {
nob::run_cmd_and_fail!("docker", "push", &image);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment