Skip to content

Commit e7a0f83

Browse files
authored
Merge pull request #98 from jessebraham/fixes/espflash-auto-detection
Fix the logic handling missing serial port command-line argument
2 parents 565aa02 + e0a00ab commit e7a0f83

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

espflash/src/main.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,15 @@ pub struct SaveImageOpts {
5050

5151
fn main() -> Result<()> {
5252
miette::set_panic_hook();
53+
5354
let mut opts = Opts::parse();
5455
let config = Config::load();
5556

56-
// if only a single argument is passed, it's always the elf
57-
if opts.image.is_none() && config.connection.serial.is_some() {
57+
// If only a single argument is passed, it's always going to be the ELF file. In
58+
// the case that the serial port was not provided as a command-line argument,
59+
// we will either load the value specified in the configuration file or do port
60+
// auto-detection instead.
61+
if opts.image.is_none() && opts.connect_args.serial.is_some() {
5862
swap(&mut opts.image, &mut opts.connect_args.serial);
5963
}
6064

0 commit comments

Comments
 (0)