Skip to content

Commit bb9f1f5

Browse files
committed
Fix a logical error preventing the board-info subcommand from being invoked
1 parent 8dd9fec commit bb9f1f5

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

espflash/src/main.rs

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -53,19 +53,21 @@ fn main() -> Result<()> {
5353
let mut opts = Opts::parse();
5454
let config = Config::load()?;
5555

56-
// If neither the IMAGE nor SERIAL arguments have been provided, print the help
57-
// message and exit.
58-
if opts.image.is_none() && opts.connect_opts.serial.is_none() {
59-
Opts::command().print_help().ok();
60-
return Ok(());
61-
}
56+
if !matches!(opts.subcommand, Some(SubCommand::BoardInfo(..))) {
57+
// If neither the IMAGE nor SERIAL arguments have been provided, print the
58+
// help message and exit.
59+
if opts.image.is_none() && opts.connect_opts.serial.is_none() {
60+
Opts::command().print_help().ok();
61+
return Ok(());
62+
}
6263

63-
// If only a single argument is passed, it *should* always be the ELF file.
64-
// In the case that the serial port was not provided as a command-line argument,
65-
// we will either load the value specified in the configuration file or do port
66-
// auto-detection instead.
67-
if opts.image.is_none() && opts.connect_opts.serial.is_some() {
68-
swap(&mut opts.image, &mut opts.connect_opts.serial);
64+
// If only a single argument is passed, it *should* always be the ELF file. In
65+
// the case that the serial port was not provided as a command-line argument, we
66+
// will either load the value specified in the configuration file or do port
67+
// auto-detection instead.
68+
if opts.image.is_none() && opts.connect_opts.serial.is_some() {
69+
swap(&mut opts.image, &mut opts.connect_opts.serial);
70+
}
6971
}
7072

7173
if let Some(subcommand) = opts.subcommand {

0 commit comments

Comments
 (0)