Skip to content

Commit 2c00fd1

Browse files
committed
Make erasing partitions possible when using package metadata, improve error help
1 parent 33e32c1 commit 2c00fd1

File tree

2 files changed

+7
-15
lines changed

2 files changed

+7
-15
lines changed

espflash/src/cli/mod.rs

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -89,21 +89,10 @@ pub struct FlashArgs {
8989
#[arg(long, value_name = "FILE")]
9090
pub bootloader: Option<PathBuf>,
9191
/// Erase partitions by label
92-
#[arg(
93-
long,
94-
requires = "partition_table",
95-
value_name = "LABELS",
96-
value_delimiter = ','
97-
)]
92+
#[arg(long, value_name = "LABELS", value_delimiter = ',')]
9893
pub erase_parts: Option<Vec<String>>,
9994
/// Erase specified data partitions
100-
#[arg(
101-
long,
102-
requires = "partition_table",
103-
value_name = "PARTS",
104-
value_enum,
105-
value_delimiter = ','
106-
)]
95+
#[arg(long, value_name = "PARTS", value_enum, value_delimiter = ',')]
10796
pub erase_data_parts: Option<Vec<DataType>>,
10897
/// Image format to flash
10998
#[arg(long, value_enum)]

espflash/src/error.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -387,8 +387,11 @@ impl From<String> for MissingPartition {
387387
}
388388

389389
#[derive(Debug, Error, Diagnostic)]
390-
#[error("No partition table could be found at the specified path")]
391-
#[diagnostic(code(espflash::partition_table::missing_partition_table))]
390+
#[error("No partition table could be found")]
391+
#[diagnostic(
392+
code(espflash::partition_table::missing_partition_table),
393+
help("Try providing a CSV or binary paritition table with the `--partition-table` argument.")
394+
)]
392395
pub struct MissingPartitionTable;
393396

394397
#[derive(Debug, Error)]

0 commit comments

Comments
 (0)