pub async fn show(svc: &str, conf: &Config, reg: &Region) -> Result<()> {
    let mf = shipcat_filebacked::load_manifest(svc, conf, reg).await?;
    let api = ShipKube::new(&mf).await?;
    let crd = api.get().await?;
    let pod_res = api.get_pods().await;

    let md = mf.metadata.clone().expect("need metadata");
    let ver = crd.spec.version.expect("need version");
    let support = md.support.clone().unwrap();
    let link = md.github_link_for_version(&ver);
    // crazy terminal hyperlink escape codes with rust format {} parts:
    let term_repo = format!("\x1B]8;;{}\x07{}\x1B]8;;\x07", md.repo, mf.name.to_uppercase());
    let term_version = format!("\x1B]8;;{}\x07{}\x1B]8;;\x07", link, ver);
    let slack_link = format!(
        "\x1B]8;;{}\x07{}\x1B]8;;\x07",
        support.link(&conf.slack),
        *support
    );

    let mut printed = false;
    if let Some(stat) = &crd.status {
        if let Some(summary) = &stat.summary {
            if let Some(successver) = &summary.last_successful_rollout_version {
                if successver != &ver {
                    print!("==> {} is requesting {}", term_repo, term_version);
                    print!(" but last successful deploy used {}", successver);
                    println!();
                } else {
                    println!("==> {} is running {}", term_repo, term_version);
                }
                printed = true;
            }
        }
    }
    if !printed {
        println!("==> {} is requesting {}", term_repo, term_version);
    }
    println!("{}", slack_link);
    println!();

    println!("==> CONDITIONS");
    if let Some(stat) = crd.status {
        let conds = &stat.conditions;
        if let Some(gen) = &conds.generated {
            println!("Generated {}", format_condition(gen)?);
        }
        if let Some(app) = &conds.applied {
            println!("Applied {}", format_condition(app)?);
        }
        if let Some(ro) = &conds.rolledout {
            println!("RolledOut {}", format_condition(ro)?);
        }
    }
    println!();

    if let Ok(pods) = pod_res {
        println!("==> RESOURCES");
        let mut pvec = pods.into_iter().collect::<Vec<Pod>>();
        pvec.sort_by_key(|p| {
            p.metadata
                .as_ref()
                .unwrap()
                .creation_timestamp
                .as_ref()
                .unwrap()
                .0
        });
        format_pods(pvec)?;
    }
    Ok(())
}
/// Entry point for `shipcat status`
Entry point for `shipcat status`
Entry point for ` shipcat status `
pub async fn show(svc: &str, conf: &Config, reg: &Region) -> Result<()> {
    let mf = shipcat_filebacked::load_manifest(svc, conf, reg).await?;
    let api = ShipKube::new(&mf).await?;
    let crd = api.get().await?;
    let pod_res = api.get_pods().await;
    let md = mf.metadata.clone().expect("need metadata");
    let ver = crd.spec.version.expect("need version");
    let support = md.support.clone().unwrap();
    let link = md.github_link_for_version(&ver);
    // crazy terminal hyperlink escape codes with rust format {} parts:
    let term_repo = format!("\x1B]8;;{}\x07{}\x1B]8;;\x07", md.repo, mf.name.to_uppercase());
    let term_version = format!("\x1B]8;;{}\x07{}\x1B]8;;\x07", link, ver);
    let slack_link = format!(
        "\x1B]8;;{}\x07{}\x1B]8;;\x07",
        support.link(&conf.slack),
        *support
    );
    let mut printed = false;
    if let Some(stat) = &crd.status {
        if let Some(summary) = &stat.summary {
            if let Some(successver) = &summary.last_successful_rollout_version {
                if successver != &ver {
                    print!("==> {} is requesting {}", term_repo, term_version);
                    print!(" but last successful deploy used {}", successver);
                    println!();
                } else {
                    println!("==> {} is running {}", term_repo, term_version);
                }
                printed = true;
            }
        }
    }
    if !printed {
        println!("==> {} is requesting {}", term_repo, term_version);
    }
    println!("{}", slack_link);
    println!();
    println!("==> CONDITIONS");
    if let Some(stat) = crd.status {
        let conds = &stat.conditions;
        if let Some(gen) = &conds.generated {
            println!("Generated {}", format_condition(gen)?);
        }
        if let Some(app) = &conds.applied {
            println!("Applied {}", format_condition(app)?);
        }
        if let Some(ro) = &conds.rolledout {
            println!("RolledOut {}", format_condition(ro)?);
        }
    }
    println!();
    if let Ok(pods) = pod_res {
        println!("==> RESOURCES");
        let mut pvec = pods.into_iter().collect::<Vec<Pod>>();
        pvec.sort_by_key(|p| {
            p.metadata
                .as_ref()
                .unwrap()
                .creation_timestamp
                .as_ref()
                .unwrap()
                .0
        });
        format_pods(pvec)?;
    }
    Ok(())
}
pub async fn show ( svc : & str , conf : & Config , reg : & Region ) -> Result < ( ) > { let mf = shipcat_filebacked :: load_manifest ( svc , conf , reg ) . await ? ; let api = ShipKube :: new ( & mf ) . await ? ; let crd = api . get ( ) . await ? ; let pod_res = api . get_pods ( ) . await ; let md = mf . metadata . clone ( ) . expect ( " " ) ; let ver = crd . spec . version . expect ( " " ) ; let support = md . support . clone ( ) . unwrap ( ) ; let link = md . github_link_for_version ( & ver ) ; // crazy terminal hyperlink escape codes with rust format {} parts: let term_repo = format ! ( " \x1B \x07 \x1B \x07 " md repo mf name to_uppercase ( ) ) ; let term_version = format ! ( " \x1B \x07 \x1B \x07 " link ver ) ; let slack_link = format ! ( " \x1B \x07 \x1B \x07 " support link ( conf slack ) support ) ; let mut printed = false ; if let Some ( stat ) = & crd . status { if let Some ( summary ) = & stat . summary { if let Some ( successver ) = & summary . last_successful_rollout_version { if successver != & ver { print ! ( " " term_repo term_version ) ; print ! ( " " successver ) ; println ! ( ) ; } else { println ! ( " " term_repo term_version ) ; } printed = true ; } } } if ! printed { println ! ( " " term_repo term_version ) ; } println ! ( " " slack_link ) ; println ! ( ) ; println ! ( " " ) ; if let Some ( stat ) = crd . status { let conds = & stat . conditions ; if let Some ( gen ) = & conds . generated { println ! ( " " format_condition ( gen ) ) ; } if let Some ( app ) = & conds . applied { println ! ( " " format_condition ( app ) ) ; } if let Some ( ro ) = & conds . rolledout { println ! ( " " format_condition ( ro ) ) ; } } println ! ( ) ; if let Ok ( pods ) = pod_res { println ! ( " " ) ; let mut pvec = pods . into_iter ( ) . collect :: < Vec < Pod > > ( ) ; pvec . sort_by_key ( | p | { p . metadata . as_ref ( ) . unwrap ( ) . creation_timestamp . as_ref ( ) . unwrap ( ) . 0 } ) ; format_pods ( pvec ) ? ; } Ok ( ( ) ) }
Entry point for `shipcat status`
Entry point for ` shipcat status `
svc
&str
conf
&Config
reg
&Region
svc
&str
conf
&Config
reg
&Region