From e0a00abc6808ccf71abe12116b2435f04f31be34 Mon Sep 17 00:00:00 2001 From: Jesse Braham Date: Wed, 24 Nov 2021 12:09:01 -0800 Subject: [PATCH] Fix the logic handling missing serial port command-line argument --- espflash/src/main.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/espflash/src/main.rs b/espflash/src/main.rs index d2f4aafc..1ea139e3 100644 --- a/espflash/src/main.rs +++ b/espflash/src/main.rs @@ -50,11 +50,15 @@ pub struct SaveImageOpts { fn main() -> Result<()> { miette::set_panic_hook(); + let mut opts = Opts::parse(); let config = Config::load(); - // if only a single argument is passed, it's always the elf - if opts.image.is_none() && config.connection.serial.is_some() { + // If only a single argument is passed, it's always going to be the ELF file. In + // the case that the serial port was not provided as a command-line argument, + // we will either load the value specified in the configuration file or do port + // auto-detection instead. + if opts.image.is_none() && opts.connect_args.serial.is_some() { swap(&mut opts.image, &mut opts.connect_args.serial); }