From 548b87ae215a6e18f36bdb63cc930ee397254a7a Mon Sep 17 00:00:00 2001 From: Austin Gill Date: Mon, 6 Nov 2023 21:48:00 -0600 Subject: [PATCH] Enable separate input and output driver types --- examples/forward.rs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/examples/forward.rs b/examples/forward.rs index a71ef8f..a17eee6 100644 --- a/examples/forward.rs +++ b/examples/forward.rs @@ -54,17 +54,22 @@ struct Options { /// The interface to read traffic from /// /// Can be either a string interface name, or an integer interface index - #[clap(short, long, default_value_t = String::from("can0"))] + #[clap(short = 'i', long, default_value_t = String::from("can0"))] pub input_interface: String, /// The interface to write traffic to /// /// Can be either a string interface name, or an integer interface index - #[clap(short, long, default_value_t = String::from("can1"))] + #[clap(short = 'o', long, default_value_t = String::from("can1"))] pub output_interface: String, - #[clap(short, long)] - pub driver: CanDriver, + /// The driver type to use for the input + #[clap(short = 'I', long)] + pub input_driver: CanDriver, + + /// The driver type to use for the output + #[clap(short = 'O', long)] + pub output_driver: CanDriver, } fn create_driver(iface: &str, driver: CanDriver) -> Box { @@ -106,8 +111,8 @@ fn main() { opts.output_interface ); - let mut input = create_driver(&opts.input_interface, opts.driver.clone()); - let mut output = create_driver(&opts.output_interface, opts.driver); + let mut input = create_driver(&opts.input_interface, opts.input_driver); + let mut output = create_driver(&opts.output_interface, opts.output_driver); input.open().unwrap(); output.open().unwrap();