From 9ff8ad5ad90e0478f9bf386801636bd9929696d6 Mon Sep 17 00:00:00 2001 From: Tim de Jager Date: Thu, 11 Apr 2024 14:40:50 +0200 Subject: [PATCH 1/3] fix: small typo in list cli --- src/cli/list.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cli/list.rs b/src/cli/list.rs index eae1bf599..6bf4b5e4b 100644 --- a/src/cli/list.rs +++ b/src/cli/list.rs @@ -21,7 +21,7 @@ use crate::Project; pub enum SortBy { Size, Name, - Type, + Kind, } /// List project's packages. Highlighted packages are explicit dependencies. @@ -187,7 +187,7 @@ pub async fn execute(args: Args) -> miette::Result<()> { SortBy::Name => { packages_to_output.sort_by(|a, b| a.name.cmp(&b.name)); } - SortBy::Type => { + SortBy::Kind => { packages_to_output.sort_by(|a, b| a.kind.cmp(&b.kind)); } } From eacc4c4bbad670622b530c4a0229367f33981d03 Mon Sep 17 00:00:00 2001 From: Tim de Jager Date: Thu, 11 Apr 2024 15:00:56 +0200 Subject: [PATCH 2/3] fix: alias so as to not be a breaking change --- src/cli/list.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/cli/list.rs b/src/cli/list.rs index 6bf4b5e4b..173773330 100644 --- a/src/cli/list.rs +++ b/src/cli/list.rs @@ -21,6 +21,7 @@ use crate::Project; pub enum SortBy { Size, Name, + #[value(alias = "type")] Kind, } From d828b06b9c178923fbf5e3b413289841a362b395 Mon Sep 17 00:00:00 2001 From: Tim de Jager Date: Thu, 11 Apr 2024 15:16:19 +0200 Subject: [PATCH 3/3] fix: added some documentation on breaking changes --- CONTRIBUTING.md | 17 +++++++++++++++++ src/cli/list.rs | 1 + 2 files changed, 18 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0ee5707c9..028c7c001 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -87,3 +87,20 @@ To sync the colors of the different parts of the ui, we use the following rules: - `style("task").blue()`: The task name These styles are put in the `consts` module or are a `.fancy_display()` on the names. If you want to add a new generic color, please add it there. + + +## Comment for Breaking Change +If you have a work-around for a potential breaking change, please add a comment in the code where you think the breaking change will happen. And what needs to be done when we **actually** want to break it. Use `BREAK:` in the comment to denote this. + +For example: +```rust +// an enum to sort by size or name +#[derive(clap::ValueEnum, Clone, Debug, Serialize)] +pub enum SortBy { + Size, + Name, + // BREAK: remove the alias + #[value(alias = "type")] + Kind, +} +``` diff --git a/src/cli/list.rs b/src/cli/list.rs index 173773330..8dcafe7c1 100644 --- a/src/cli/list.rs +++ b/src/cli/list.rs @@ -21,6 +21,7 @@ use crate::Project; pub enum SortBy { Size, Name, + // BREAK: remove the alias #[value(alias = "type")] Kind, }