diff --git a/src/args.rs b/src/args.rs index 39f64c1..4fa42d1 100644 --- a/src/args.rs +++ b/src/args.rs @@ -103,6 +103,8 @@ pub enum GetCommands { MonthlyTx, /// Fetch realtime RX bytes. RealtimeRx, + /// Fetch realtime TX bytes. + RealtimeTx, } #[derive(Subcommand, Debug)] diff --git a/src/main.rs b/src/main.rs index a793d50..2e48fbd 100644 --- a/src/main.rs +++ b/src/main.rs @@ -44,6 +44,7 @@ async fn main() -> EyreResult<()> { GetCommands::MonthlyRx => router.show::().await?, GetCommands::MonthlyTx => router.show::().await?, GetCommands::RealtimeRx => router.show::().await?, + GetCommands::RealtimeTx => router.show::().await?, }, TopLevelCommands::Post { command } => match command { PostCommands::Reboot => router.reboot().await.print_table(), diff --git a/src/proc_get.rs b/src/proc_get.rs index a327a8d..afdc8af 100644 --- a/src/proc_get.rs +++ b/src/proc_get.rs @@ -757,3 +757,23 @@ impl ProcGet for RealtimeRx { println!("{table}"); } } + +#[derive(Debug, Deserialize)] +pub struct RealtimeTx { + pub realtime_tx_bytes: BoxStr, +} + +impl ProcGet for RealtimeTx { + const CMD: &str = "realtime_tx_bytes"; + type Params = (); + + fn print_table(&self) { + let mut table = create_table(); + + let size = self.realtime_tx_bytes.parse::().unwrap(); + let size = humansize::format_size(size, humansize::DECIMAL); + + table.set_header(["Realtime TX Bytes"]).add_row([&size]); + println!("{table}"); + } +}