use crate::{env::Env, error::ClickError, output::ClickWriter};
use clap::ArgMatches;
use std::io::Write;
pub fn crd_describe(
name: &str,
namespace: &str,
_type: &str,
group_version: &str,
matches: &ArgMatches,
env: &Env,
writer: &mut ClickWriter,
) -> Result<(), ClickError> {
let (request, _) = crate::crd::read_namespaced_resource(name, namespace, _type, group_version)?;
match env
.run_on_context(|c| c.read::<crate::crd::ReadResourceValueResponse>(request))
.unwrap()
{
crate::crd::ReadResourceValueResponse::Ok(t) => {
if !super::maybe_full_describe_output(matches, &t, writer) {
clickwriteln!(writer, "{} {}", _type, super::NOTSUPPORTED);
}
}
crate::crd::ReadResourceValueResponse::Other(e) => {
clickwriteln!(writer, "Error getting response: {:?}", e);
}
};
Ok(())
}