File tree Expand file tree Collapse file tree 3 files changed +14
-5
lines changed Expand file tree Collapse file tree 3 files changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -53,7 +53,9 @@ struct EspFlashOpts {
5353
5454#[ derive( Parser ) ]
5555pub enum SubCommand {
56+ /// Display information about the connected board and exit without flashing
5657 BoardInfo ( ConnectOpts ) ,
58+ /// Save the image to disk instead of flashing to device
5759 SaveImage ( SaveImageOpts ) ,
5860}
5961
@@ -82,7 +84,6 @@ pub struct BuildOpts {
8284 pub unstable : Option < Vec < String > > ,
8385}
8486
85- /// Save the image to disk instead of flashing to device
8687#[ derive( Parser ) ]
8788pub struct SaveImageOpts {
8889 #[ clap( flatten) ]
Original file line number Diff line number Diff line change @@ -64,7 +64,7 @@ pub fn get_serial_port_info(
6464fn find_serial_port ( ports : & [ SerialPortInfo ] , name : String ) -> Option < SerialPortInfo > {
6565 ports
6666 . iter ( )
67- . find ( |port| port. port_name == name)
67+ . find ( |port| port. port_name . to_lowercase ( ) == name. to_lowercase ( ) )
6868 . map ( |port| port. to_owned ( ) )
6969}
7070
Original file line number Diff line number Diff line change @@ -28,11 +28,12 @@ struct Opts {
2828
2929#[ derive( Parser ) ]
3030pub enum SubCommand {
31+ /// Display information about the connected board and exit without flashing
3132 BoardInfo ( ConnectOpts ) ,
33+ /// Save the image to disk instead of flashing to device
3234 SaveImage ( SaveImageOpts ) ,
3335}
3436
35- /// Save the image to disk instead of flashing to device
3637#[ derive( Parser ) ]
3738pub struct SaveImageOpts {
3839 /// Image format to flash
@@ -52,8 +53,15 @@ fn main() -> Result<()> {
5253 let mut opts = Opts :: parse ( ) ;
5354 let config = Config :: load ( ) ?;
5455
55- // If only a single argument is passed, it's always going to be the ELF file. In
56- // the case that the serial port was not provided as a command-line argument,
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 :: into_app ( ) . print_help ( ) . ok ( ) ;
60+ return Ok ( ( ) ) ;
61+ }
62+
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,
5765 // we will either load the value specified in the configuration file or do port
5866 // auto-detection instead.
5967 if opts. image . is_none ( ) && opts. connect_opts . serial . is_some ( ) {
You can’t perform that action at this time.
0 commit comments