Skip to content

Commit 2e73c4f

Browse files
Update log-format flag and merge monitor methods (#499)
* fix: Update log-format flag * feat: Merge monitor and monitor_with methods
1 parent 1b390aa commit 2e73c4f

File tree

4 files changed

+12
-22
lines changed

4 files changed

+12
-22
lines changed

cargo-espflash/src/main.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ use clap::{Args, CommandFactory, Parser, Subcommand};
99
use espflash::{
1010
cli::{
1111
self, board_info, completions, config::Config, connect, erase_flash, erase_partitions,
12-
erase_region, flash_elf_image, monitor::monitor_with, parse_partition_table,
13-
partition_table, print_board_info, save_elf_as_image, serial_monitor, CompletionsArgs,
14-
ConnectArgs, EraseFlashArgs, EraseRegionArgs, EspflashProgress, FlashConfigArgs,
15-
MonitorArgs, PartitionTableArgs,
12+
erase_region, flash_elf_image, monitor::monitor, parse_partition_table, partition_table,
13+
print_board_info, save_elf_as_image, serial_monitor, CompletionsArgs, ConnectArgs,
14+
EraseFlashArgs, EraseRegionArgs, EspflashProgress, FlashConfigArgs, MonitorArgs,
15+
PartitionTableArgs,
1616
},
1717
error::Error as EspflashError,
1818
image_format::ImageFormatKind,
@@ -342,7 +342,7 @@ fn flash(args: FlashArgs, config: &Config) -> Result<()> {
342342
115_200
343343
};
344344

345-
monitor_with(
345+
monitor(
346346
flasher.into_interface(),
347347
Some(&elf_data),
348348
pid,

espflash/src/bin/espflash.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use clap::{Args, CommandFactory, Parser, Subcommand};
88
use espflash::{
99
cli::{
1010
self, board_info, completions, config::Config, connect, erase_flash, erase_partitions,
11-
erase_region, flash_elf_image, monitor::monitor_with, parse_partition_table, parse_uint32,
11+
erase_region, flash_elf_image, monitor::monitor, parse_partition_table, parse_uint32,
1212
partition_table, print_board_info, save_elf_as_image, serial_monitor, CompletionsArgs,
1313
ConnectArgs, EraseFlashArgs, EraseRegionArgs, EspflashProgress, FlashConfigArgs,
1414
MonitorArgs, PartitionTableArgs,
@@ -264,7 +264,7 @@ fn flash(args: FlashArgs, config: &Config) -> Result<()> {
264264
115_200
265265
};
266266

267-
monitor_with(
267+
monitor(
268268
flasher.into_interface(),
269269
Some(&elf_data),
270270
pid,

espflash/src/cli/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ use serialport::{SerialPortType, UsbPortInfo};
2626

2727
use self::{
2828
config::Config,
29-
monitor::{monitor_with, LogFormat},
29+
monitor::{monitor, LogFormat},
3030
serial::get_serial_port_info,
3131
};
3232
use crate::{
@@ -145,7 +145,7 @@ pub struct FlashArgs {
145145
#[arg(long)]
146146
pub ram: bool,
147147
/// Logging format.
148-
#[arg(long, short = 'f', default_value = "serial", requires = "monitor")]
148+
#[arg(long, short = 'L', default_value = "serial", requires = "monitor")]
149149
pub log_format: LogFormat,
150150
}
151151

@@ -202,7 +202,7 @@ pub struct MonitorArgs {
202202
#[clap(flatten)]
203203
connect_args: ConnectArgs,
204204
/// Logging format.
205-
#[arg(long, short = 'f', default_value = "serial")]
205+
#[arg(long, short = 'L', default_value = "serial")]
206206
pub log_format: LogFormat,
207207
}
208208

@@ -310,7 +310,7 @@ pub fn serial_monitor(args: MonitorArgs, config: &Config) -> Result<()> {
310310
115_200
311311
};
312312

313-
monitor_with(
313+
monitor(
314314
flasher.into_interface(),
315315
elf.as_deref(),
316316
pid,

espflash/src/cli/monitor/mod.rs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -63,18 +63,8 @@ impl Drop for RawModeGuard {
6363
}
6464
}
6565

66-
/// Open a serial monitor on the given interface
67-
pub fn monitor(
68-
serial: Interface,
69-
elf: Option<&[u8]>,
70-
pid: u16,
71-
baud: u32,
72-
) -> serialport::Result<()> {
73-
monitor_with(serial, elf, pid, baud, LogFormat::Serial)
74-
}
75-
7666
/// Open a serial monitor on the given interface, using the given input parser.
77-
pub fn monitor_with(
67+
pub fn monitor(
7868
mut serial: Interface,
7969
elf: Option<&[u8]>,
8070
pid: u16,

0 commit comments

Comments
 (0)