From 770ed397672cb985510df8fc0fe3b43792c65bf5 Mon Sep 17 00:00:00 2001 From: Alex Janka Date: Sun, 5 Feb 2023 10:04:17 +1100 Subject: [PATCH] json prints without extra shit --- src/main.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 6381bf1..e25b4ed 100644 --- a/src/main.rs +++ b/src/main.rs @@ -47,7 +47,7 @@ struct Args { command: Option, } -#[derive(Subcommand)] +#[derive(Subcommand, PartialEq)] enum Commands { /// Get single EEPROM value Get { name: String }, @@ -87,7 +87,9 @@ fn main() { } let (_info, ram_data, eeprom_data, modbus) = if !args.fake { - println!("Connecting to device on {}", args.serial_port); + if args.command != Some(Commands::PrintJSON) { + println!("Connecting to device on {}", args.serial_port); + } let modbus = connect_modbus(&args.serial_port); let (a, b, c) = get_data(&modbus); (a, b, c, Some(modbus))