Skip to content

Commit 41bbefb

Browse files
committed
feature: supports pre-fill short description for custom conventional commit types (#2024)
Signed-off-by: leo <[email protected]>
1 parent c07c279 commit 41bbefb

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,8 @@ You can define your own conventional commit types (per-repository) by following
199199
{
200200
"Name": "New Feature",
201201
"Type": "Feature",
202-
"Description": "Adding a new feature"
202+
"Description": "Adding a new feature",
203+
"PrefillShortDesc": "this is a test"
203204
},
204205
{
205206
"Name": "Bug Fixes",

src/Models/ConventionalCommitType.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@ namespace SourceGit.Models
66
{
77
public class ConventionalCommitType
88
{
9-
public string Name { get; set; }
10-
public string Type { get; set; }
11-
public string Description { get; set; }
9+
public string Name { get; set; } = string.Empty;
10+
public string Type { get; set; } = string.Empty;
11+
public string Description { get; set; } = string.Empty;
12+
public string PrefillShortDesc { get; set; } = string.Empty;
1213

1314
public ConventionalCommitType(string name, string type, string description)
1415
{

src/ViewModels/ConventionalCommitMessageBuilder.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@ public List<Models.ConventionalCommitType> Types
2020
public Models.ConventionalCommitType SelectedType
2121
{
2222
get => _selectedType;
23-
set => SetProperty(ref _selectedType, value, true);
23+
set
24+
{
25+
if (SetProperty(ref _selectedType, value, true) && value is { PrefillShortDesc: { Length: > 0 } })
26+
Description = value.PrefillShortDesc;
27+
}
2428
}
2529

2630
public string Scope

0 commit comments

Comments
 (0)