Skip to content

Commit

Permalink
Updated help texts
Browse files Browse the repository at this point in the history
  • Loading branch information
AVee committed Feb 14, 2025
1 parent 9b58048 commit 0aafb3f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]

### Added
Add list-ports command to list available serial ports.
- Add list-ports command to list available serial ports.

### Changed

Expand Down
4 changes: 2 additions & 2 deletions cargo-espflash/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ enum Commands {
HoldInReset(ConnectArgs),
/// List serial ports available for flashing.
///
/// Only lists ports of devices known to be used on development boards. Use
/// -a to show all available ports.
/// The default behavior is to only list ports of devices known to be used on development
/// boards.
ListPorts(ListPortsArgs),
/// Open the serial monitor without flashing the connected target device
Monitor(MonitorArgs),
Expand Down
11 changes: 6 additions & 5 deletions espflash/src/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -293,9 +293,10 @@ pub struct ChecksumMd5Args {
#[derive(Debug, Args)]
#[non_exhaustive]
pub struct ListPortsArgs {
/// List all available serial ports.
#[arg(short, long)]
pub all_ports: bool,
/// List all available serial ports, instead of just those likely to be development boards.
/// Includes non-usb ports such as PCI devices.
#[arg(short = 'a', long)]
pub list_all_ports: bool,

/// Only print the name of the ports and nothing else. Useful for scripting.
#[arg(short, long)]
Expand Down Expand Up @@ -392,13 +393,13 @@ pub fn checksum_md5(args: &ChecksumMd5Args, config: &Config) -> Result<()> {
pub fn list_ports(args: &ListPortsArgs, config: &Config) -> Result<()> {
let mut ports: Vec<SerialPortInfo> = serial::detect_usb_serial_ports(true)?
.into_iter()
.filter(|p| args.all_ports || serial::known_ports_filter(p, config))
.filter(|p| args.list_all_ports || serial::known_ports_filter(p, config))
.collect();
if ports.is_empty() {
if !args.name_only {
println!(
"No {}serial ports found.",
if args.all_ports { "" } else { "known " }
if args.list_all_ports { "" } else { "known " }
);
}
} else {
Expand Down

0 comments on commit 0aafb3f

Please sign in to comment.