fn print_deployments(
    deplist: DeploymentList,
    _show_labels: bool,
    regex: Option<Regex>,
    writer: &mut ClickWriter,
) -> DeploymentList {
    let mut table = Table::new();
    table.set_titles(row![
        "####",
        "Name",
        "Desired",
        "Current",
        "Up To Date",
        "Available",
        "Age"
    ]);
    let deps_specs = deplist.items.into_iter().map(|dep| {
        let mut specs = Vec::new();
        specs.push(CellSpec::new_index());
        specs.push(CellSpec::new_owned(dep.metadata.name.clone()));
        specs.push(CellSpec::with_align_owned(
            format!("{}", dep.spec.replicas),
            format::Alignment::CENTER,
        ));
        specs.push(CellSpec::with_align_owned(
            format!("{}", dep.status.replicas),
            format::Alignment::CENTER,
        ));
        specs.push(CellSpec::with_align_owned(
            format!("{}", dep.status.updated),
            format::Alignment::CENTER,
        ));
        specs.push(CellSpec::with_align_owned(
            format!("{}", dep.status.available),
            format::Alignment::CENTER,
        ));
        specs.push(CellSpec::new_owned(format!(
            "{}",
            time_since(dep.metadata.creation_timestamp.unwrap())
        )));
        (dep, specs)
    });

    let filtered = match regex {
        Some(r) => ::table::filter(deps_specs, r),
        None => deps_specs.collect(),
    };

    ::table::print_table(&mut table, &filtered, writer);

    let final_deps = filtered.into_iter().map(|dep_spec| dep_spec.0).collect();
    DeploymentList { items: final_deps }
}
/// Print out the specified list of deployments in a pretty format
Print out the specified list of deployments in a pretty format
Print out the specified list of deployments in a pretty format
fn print_deployments(
    deplist: DeploymentList,
    _show_labels: bool,
    regex: Option<Regex>,
    writer: &mut ClickWriter,
) -> DeploymentList {
    let mut table = Table::new();
    table.set_titles(row![
        "####",
        "Name",
        "Desired",
        "Current",
        "Up To Date",
        "Available",
        "Age"
    ]);
    let deps_specs = deplist.items.into_iter().map(|dep| {
        let mut specs = Vec::new();
        specs.push(CellSpec::new_index());
        specs.push(CellSpec::new_owned(dep.metadata.name.clone()));
        specs.push(CellSpec::with_align_owned(
            format!("{}", dep.spec.replicas),
            format::Alignment::CENTER,
        ));
        specs.push(CellSpec::with_align_owned(
            format!("{}", dep.status.replicas),
            format::Alignment::CENTER,
        ));
        specs.push(CellSpec::with_align_owned(
            format!("{}", dep.status.updated),
            format::Alignment::CENTER,
        ));
        specs.push(CellSpec::with_align_owned(
            format!("{}", dep.status.available),
            format::Alignment::CENTER,
        ));
        specs.push(CellSpec::new_owned(format!(
            "{}",
            time_since(dep.metadata.creation_timestamp.unwrap())
        )));
        (dep, specs)
    });
    let filtered = match regex {
        Some(r) => ::table::filter(deps_specs, r),
        None => deps_specs.collect(),
    };
    ::table::print_table(&mut table, &filtered, writer);
    let final_deps = filtered.into_iter().map(|dep_spec| dep_spec.0).collect();
    DeploymentList { items: final_deps }
}
fn print_deployments ( deplist : DeploymentList , _show_labels : bool , regex : Option < Regex > , writer : & mut ClickWriter , ) -> DeploymentList { let mut table = Table :: new ( ) ; table . set_titles ( row ! [ " " " " " " " " " " " " " " ] ) ; let deps_specs = deplist . items . into_iter ( ) . map ( | dep | { let mut specs = Vec :: new ( ) ; specs . push ( CellSpec :: new_index ( ) ) ; specs . push ( CellSpec :: new_owned ( dep . metadata . name . clone ( ) ) ) ; specs . push ( CellSpec :: with_align_owned ( format ! ( " " dep spec replicas ) , format :: Alignment :: CENTER , ) ) ; specs . push ( CellSpec :: with_align_owned ( format ! ( " " dep status replicas ) , format :: Alignment :: CENTER , ) ) ; specs . push ( CellSpec :: with_align_owned ( format ! ( " " dep status updated ) , format :: Alignment :: CENTER , ) ) ; specs . push ( CellSpec :: with_align_owned ( format ! ( " " dep status available ) , format :: Alignment :: CENTER , ) ) ; specs . push ( CellSpec :: new_owned ( format ! ( " " time_since ( dep metadata creation_timestamp unwrap ( ) ) ) ) ) ; ( dep , specs ) } ) ; let filtered = match regex { Some ( r ) => :: table :: filter ( deps_specs , r ) , None => deps_specs . collect ( ) , } ; :: table :: print_table ( & mut table , & filtered , writer ) ; let final_deps = filtered . into_iter ( ) . map ( | dep_spec | dep_spec . 0 ) . collect ( ) ; DeploymentList { items : final_deps } }
Print out the specified list of deployments in a pretty format
Print out the specified list of deployments in a pretty format
deplist
DeploymentList
_show_labels
bool
regex
Option<Regex>
writer
&mut ClickWriter
deplist
DeploymentList
_show_labels
bool
regex
Option<Regex>
writer
&mut ClickWriter