From 2390c0cd05c3a64deebcfd36caa1e02482f99e8c Mon Sep 17 00:00:00 2001 From: Jesse Braham Date: Mon, 29 May 2023 08:37:08 -0700 Subject: [PATCH] Make erasing partitions possible when using package metadata, improve error help --- espflash/src/cli/mod.rs | 15 ++------------- espflash/src/error.rs | 7 +++++-- 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/espflash/src/cli/mod.rs b/espflash/src/cli/mod.rs index 3009c3f9..bdc89d37 100644 --- a/espflash/src/cli/mod.rs +++ b/espflash/src/cli/mod.rs @@ -89,21 +89,10 @@ pub struct FlashArgs { #[arg(long, value_name = "FILE")] pub bootloader: Option, /// 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>, /// 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>, /// Image format to flash #[arg(long, value_enum)] diff --git a/espflash/src/error.rs b/espflash/src/error.rs index a4e30129..b76518f7 100644 --- a/espflash/src/error.rs +++ b/espflash/src/error.rs @@ -387,8 +387,11 @@ impl From 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)]