Make erasing partitions possible when using package metadata, improve error help

This commit is contained in:
Jesse Braham
2023-05-29 08:37:08 -07:00
committed by Jesse Braham
parent 33e32c196b
commit 2c00fd1aab
2 changed files with 7 additions and 15 deletions

View File

@@ -89,21 +89,10 @@ pub struct FlashArgs {
#[arg(long, value_name = "FILE")]
pub bootloader: Option<PathBuf>,
/// Erase partitions by label
#[arg(
long,
requires = "partition_table",
value_name = "LABELS",
value_delimiter = ','
)]
#[arg(long, value_name = "LABELS", value_delimiter = ',')]
pub erase_parts: Option<Vec<String>>,
/// Erase specified data partitions
#[arg(
long,
requires = "partition_table",
value_name = "PARTS",
value_enum,
value_delimiter = ','
)]
#[arg(long, value_name = "PARTS", value_enum, value_delimiter = ',')]
pub erase_data_parts: Option<Vec<DataType>>,
/// Image format to flash
#[arg(long, value_enum)]

View File

@@ -387,8 +387,11 @@ impl From<String> for MissingPartition {
}
#[derive(Debug, Error, Diagnostic)]
#[error("No partition table could be found at the specified path")]
#[diagnostic(code(espflash::partition_table::missing_partition_table))]
#[error("No partition table could be found")]
#[diagnostic(
code(espflash::partition_table::missing_partition_table),
help("Try providing a CSV or binary paritition table with the `--partition-table` argument.")
)]
pub struct MissingPartitionTable;
#[derive(Debug, Error)]