Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions espflash/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down