Skip to content

Commit

Permalink
feat(hub): published at method for PackageMeta
Browse files Browse the repository at this point in the history
  • Loading branch information
LeoBorai committed Oct 2, 2024
1 parent 134b057 commit 7ac68f6
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions crates/fluvio-hub-util/src/cmd/list.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
use std::sync::Arc;
use std::fmt::Debug;

use chrono::DateTime;
use chrono::Utc;
use clap::Parser;
use anyhow::Result;

Expand Down Expand Up @@ -35,6 +37,7 @@ mod output {
//! # Fluvio hub list - output processing
//!
//! Format SmartModules response based on output type
use chrono::{DateTime, Utc};
use comfy_table::{Cell, Row};
use comfy_table::CellAlignment;
use tracing::debug;
Expand All @@ -45,7 +48,8 @@ mod output {
use fluvio_extension_common::Terminal;
use fluvio_extension_common::output::TableOutputHandler;
use fluvio_extension_common::t_println;
use crate::PackageMeta;

use crate::{PackageMeta, PackageMetaExt};

#[derive(Serialize)]
struct ListConnectors(Vec<PackageMeta>);
Expand Down Expand Up @@ -78,7 +82,7 @@ mod output {
impl TableOutputHandler for ListConnectors {
/// table header implementation
fn header(&self) -> Row {
Row::from(["CONNECTOR", "Visibility"])
Row::from(["CONNECTOR", "Visibility", "Released"])
}

/// return errors in string format
Expand All @@ -94,6 +98,13 @@ mod output {
Row::from([
Cell::new(e.pkg_name()).set_alignment(CellAlignment::Left),
Cell::new(&e.visibility).set_alignment(CellAlignment::Left),
Cell::new(
e.published_at()
.map(|date| {
date.format("%Y-%m-%d %H:%M:%S").to_string()
})
.unwrap_or(String::from("N/A")),
),
])
})
.collect()
Expand Down

0 comments on commit 7ac68f6

Please sign in to comment.