pub(crate) fn hosts_table(hosts: Vec<Host>, max_width: Option<usize>) -> String {
    let mut table = Table::new();
    table.max_column_width = max_width.unwrap_or(80);
    table.style = TableStyle::blank();
    table.separate_rows = false;

    table.add_row(Row::new(vec![
        TableCell::new_with_alignment("Host ID", 1, Alignment::Left),
        TableCell::new_with_alignment("Uptime (seconds)", 1, Alignment::Left),
    ]));
    hosts.iter().for_each(|h| {
        table.add_row(Row::new(vec![
            TableCell::new_with_alignment(h.id.clone(), 1, Alignment::Left),
            TableCell::new_with_alignment(format!("{}", h.uptime_seconds), 1, Alignment::Left),
        ]))
    });

    table.render()
}
/// Helper function to print a Host list to stdout as a table
Helper function to print a Host list to stdout as a table
Helper function to print a Host list to stdout as a table
pub(crate) fn hosts_table(hosts: Vec<Host>, max_width: Option<usize>) -> String {
    let mut table = Table::new();
    table.max_column_width = max_width.unwrap_or(80);
    table.style = TableStyle::blank();
    table.separate_rows = false;
    table.add_row(Row::new(vec![
        TableCell::new_with_alignment("Host ID", 1, Alignment::Left),
        TableCell::new_with_alignment("Uptime (seconds)", 1, Alignment::Left),
    ]));
    hosts.iter().for_each(|h| {
        table.add_row(Row::new(vec![
            TableCell::new_with_alignment(h.id.clone(), 1, Alignment::Left),
            TableCell::new_with_alignment(format!("{}", h.uptime_seconds), 1, Alignment::Left),
        ]))
    });
    table.render()
}
pub ( crate ) fn hosts_table ( hosts : Vec < Host > , max_width : Option < usize > ) -> String { let mut table = Table :: new ( ) ; table . max_column_width = max_width . unwrap_or ( 80 ) ; table . style = TableStyle :: blank ( ) ; table . separate_rows = false ; table . add_row ( Row :: new ( vec ! [ TableCell new_with_alignment ( " " 1 Alignment Left ) TableCell new_with_alignment ( " " 1 Alignment Left ) ] ) ) ; hosts . iter ( ) . for_each ( | h | { table . add_row ( Row :: new ( vec ! [ TableCell new_with_alignment ( h id clone ( ) 1 Alignment Left ) TableCell new_with_alignment ( format ( " " h uptime_seconds ) 1 Alignment Left ) ] ) ) } ) ; table . render ( ) }
Helper function to print a Host list to stdout as a table
Helper function to print a Host list to stdout as a table
hosts
Vec<Host>
max_width
Option<usize>
hosts
Vec<Host>
max_width
Option<usize>