diff --git a/src/get/cronjob.rs b/src/get/cronjob.rs index e591601..973e76e 100644 --- a/src/get/cronjob.rs +++ b/src/get/cronjob.rs @@ -18,9 +18,11 @@ impl Lister for CronjobsLister { }).map(|p| p.clone()).collect())) } + // TODO - record last run and how many running (somehow) fn print(&self, resources: Vec) { + macro_rules! cols { () => ("{0: <10} {1: <10} {2: <10} {3: <10} {4: <10} {5: <10} {6: <15} {7: <10}") }; println!( - "{0: <10} {1: <10} {2: <10} {3: <10} {4: <10} {5: <10} {6: <15} {7: <10}", + cols!(), "NAMESPACE", "NAME", "SCHEDULE", "TIMEZONE", "SUSPEND", "ACTIVE", "LAST SCHEDULE", "AGE" ); let map = resources.iter().fold(HashMap::>::new(), |mut acc, item| { @@ -36,8 +38,8 @@ impl Lister for CronjobsLister { let age = age(created); println!( - "{0: <10} {1: <10} {2: <10} {3: <10} {4: <10} {5: <10} {6: <15} {7: <10}", - name.namespace, name.name, "TODO", timezone.unwrap_or("-".to_string()), "False", "-", "-", age + cols!(), + name.namespace, name.name, schedule, timezone.unwrap_or("".to_string()), "False", "-", "-", age ) } } diff --git a/src/util.rs b/src/util.rs index 24b79a5..66bd57b 100644 --- a/src/util.rs +++ b/src/util.rs @@ -176,11 +176,11 @@ pub fn hash_k8s_resource(obj: &mut (impl Metadata) -> String { match Local::now().signed_duration_since(date_time).to_std() { Ok(age) => humantime::format_duration(age).to_string() - .split_whitespace().take(2).collect::>() + .split_whitespace().take(1).collect::>() .join(""), Err(_) => "".to_string() }