@@ -90,6 +90,10 @@ pub struct ConnectArgs {
90
90
/// Serial port connected to target device
91
91
#[ arg( short = 'p' , long, env = "ESPFLASH_PORT" ) ]
92
92
pub port : Option < String > ,
93
+ /// Avoids asking the user for interactions like selecting/resetting the
94
+ /// device
95
+ #[ arg( long) ]
96
+ pub non_interactive : bool ,
93
97
}
94
98
95
99
/// Generate completions for the given shell
@@ -302,11 +306,10 @@ pub struct MonitorConfigArgs {
302
306
/// ELF image to load the symbols from
303
307
#[ arg( long, value_name = "FILE" ) ]
304
308
pub elf : Option < PathBuf > ,
305
- /// Avoids asking the user for interactions like resetting the device
306
- #[ arg( long) ]
307
- non_interactive : bool ,
308
309
/// Avoids restarting the device before monitoring
309
- #[ arg( long, requires = "non_interactive" ) ]
310
+ ///
311
+ /// Only valid when `non_interactive` is also set.
312
+ #[ arg( long) ]
310
313
no_reset : bool ,
311
314
/// The encoding of the target's serial output.
312
315
#[ arg( long, short = 'L' ) ]
@@ -421,7 +424,7 @@ pub fn connect(
421
424
. map_err ( Error :: from)
422
425
. wrap_err_with ( || format ! ( "Failed to open serial port {}" , port_info. port_name) ) ?;
423
426
424
- // NOTE: since `get_serial_port_info ` filters out all PCI Port and Bluetooth
427
+ // NOTE: since `serial_port_info ` filters out all PCI Port and Bluetooth
425
428
// serial ports, we can just pretend these types don't exist here.
426
429
let port_info = match port_info. port_type {
427
430
SerialPortType :: UsbPort ( info) => info,
@@ -659,6 +662,7 @@ pub fn serial_monitor(args: MonitorArgs, config: &Config) -> Result<()> {
659
662
elf. as_deref ( ) ,
660
663
pid,
661
664
monitor_args,
665
+ args. connect_args . non_interactive ,
662
666
)
663
667
}
664
668
@@ -1095,7 +1099,11 @@ pub fn make_flash_data(
1095
1099
/// Write a binary to the flash memory of a target device
1096
1100
pub fn write_bin ( args : WriteBinArgs , config : & Config ) -> Result < ( ) > {
1097
1101
// Check monitor arguments
1098
- check_monitor_args ( & args. monitor , & args. monitor_args ) ?;
1102
+ check_monitor_args (
1103
+ & args. monitor ,
1104
+ & args. monitor_args ,
1105
+ args. connect_args . non_interactive ,
1106
+ ) ?;
1099
1107
1100
1108
// Load the file to be flashed
1101
1109
let mut f = File :: open ( & args. file ) . into_diagnostic ( ) ?;
@@ -1132,6 +1140,7 @@ pub fn write_bin(args: WriteBinArgs, config: &Config) -> Result<()> {
1132
1140
None ,
1133
1141
pid,
1134
1142
monitor_args,
1143
+ args. connect_args . non_interactive ,
1135
1144
) ?;
1136
1145
}
1137
1146
0 commit comments