Skip to content

Commit 4e01270

Browse files
committed
feature!: add built-in parameter ${BRANCH_FRIENDLY_NAME} for custom action
- BREAKING CHANGE: Change `${BRANCH}` to pure branch name, which means it not contains the `${REMOTE}` part for remote branch - Re-design UI/UX for custom action Signed-off-by: leo <longshuang@msn.cn>
1 parent c8da655 commit 4e01270

File tree

9 files changed

+65
-44
lines changed

9 files changed

+65
-44
lines changed

src/Resources/Locales/de_DE.axaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,11 +176,9 @@
176176
<x:String x:Key="Text.Configure.CommitMessageTemplate.Name" xml:space="preserve">Template Name:</x:String>
177177
<x:String x:Key="Text.Configure.CustomAction" xml:space="preserve">BENUTZERDEFINIERTE AKTION</x:String>
178178
<x:String x:Key="Text.Configure.CustomAction.Arguments" xml:space="preserve">Argumente:</x:String>
179-
<x:String x:Key="Text.Configure.CustomAction.Arguments.Tip" xml:space="preserve">Vordefinierte Parameter: ${REPO} - Repository Pfad; ${BRANCH} - selektierter Branch; ${SHA} - Hash des selektierten Commits; ${TAG} - selektiertes Tag</x:String>
180179
<x:String x:Key="Text.Configure.CustomAction.Executable" xml:space="preserve">Ausführbare Datei:</x:String>
181180
<x:String x:Key="Text.Configure.CustomAction.InputControls" xml:space="preserve">Eingabe-Steuerelemente:</x:String>
182181
<x:String x:Key="Text.Configure.CustomAction.InputControls.Edit" xml:space="preserve">Bearbeiten</x:String>
183-
<x:String x:Key="Text.Configure.CustomAction.InputControls.Tip" xml:space="preserve">$1, $2 ... können als Argumente in Eingabe-Steuerelementen benutzt werden</x:String>
184182
<x:String x:Key="Text.Configure.CustomAction.Name" xml:space="preserve">Name:</x:String>
185183
<x:String x:Key="Text.Configure.CustomAction.Scope" xml:space="preserve">Geltungsbereich:</x:String>
186184
<x:String x:Key="Text.Configure.CustomAction.Scope.Branch" xml:space="preserve">Branch</x:String>

src/Resources/Locales/en_US.axaml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,11 +173,18 @@
173173
<x:String x:Key="Text.Configure.CommitMessageTemplate.Name" xml:space="preserve">Template Name:</x:String>
174174
<x:String x:Key="Text.Configure.CustomAction" xml:space="preserve">CUSTOM ACTION</x:String>
175175
<x:String x:Key="Text.Configure.CustomAction.Arguments" xml:space="preserve">Arguments:</x:String>
176-
<x:String x:Key="Text.Configure.CustomAction.Arguments.Tip" xml:space="preserve">Built-in parameters: ${REPO} - repository's path; ${REMOTE} - selected remote or selected branch's remote; ${BRANCH} - selected branch; ${SHA} - selected commit's hash; ${TAG} - selected tag</x:String>
176+
<x:String x:Key="Text.Configure.CustomAction.Arguments.Tip" xml:space="preserve">Built-in parameters:
177+
178+
${REPO} Repository's path
179+
${REMOTE} Selected remote or selected branch's remote
180+
${BRANCH} Selected branch, without ${REMOTE} part for remote branches
181+
${BRANCH_FRIENDLY_NAME} Firendly name of selected branch, contains ${REMOTE} part for remote branches
182+
${SHA} Selected commit's hash
183+
${TAG} Selected tag
184+
$1, $2 ... Input control values</x:String>
177185
<x:String x:Key="Text.Configure.CustomAction.Executable" xml:space="preserve">Executable File:</x:String>
178186
<x:String x:Key="Text.Configure.CustomAction.InputControls" xml:space="preserve">Input Controls:</x:String>
179187
<x:String x:Key="Text.Configure.CustomAction.InputControls.Edit" xml:space="preserve">Edit</x:String>
180-
<x:String x:Key="Text.Configure.CustomAction.InputControls.Tip" xml:space="preserve">You can use $1, $2 ... in arguments for input control values</x:String>
181188
<x:String x:Key="Text.Configure.CustomAction.Name" xml:space="preserve">Name:</x:String>
182189
<x:String x:Key="Text.Configure.CustomAction.Scope" xml:space="preserve">Scope:</x:String>
183190
<x:String x:Key="Text.Configure.CustomAction.Scope.Branch" xml:space="preserve">Branch</x:String>

src/Resources/Locales/es_ES.axaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,11 +177,9 @@
177177
<x:String x:Key="Text.Configure.CommitMessageTemplate.Name" xml:space="preserve">Nombre de la Plantilla:</x:String>
178178
<x:String x:Key="Text.Configure.CustomAction" xml:space="preserve">ACCIÓN PERSONALIZADA</x:String>
179179
<x:String x:Key="Text.Configure.CustomAction.Arguments" xml:space="preserve">Argumentos:</x:String>
180-
<x:String x:Key="Text.Configure.CustomAction.Arguments.Tip" xml:space="preserve">Parámetros incorporados: ${REPO} - ruta del repositorio; ${BRANCH} - rama seleccionada; ${SHA} - hash del commit seleccionado; ${TAG} - etiqueta seleccionada</x:String>
181180
<x:String x:Key="Text.Configure.CustomAction.Executable" xml:space="preserve">Archivo Ejecutable:</x:String>
182181
<x:String x:Key="Text.Configure.CustomAction.InputControls" xml:space="preserve">Controles de entrada:</x:String>
183182
<x:String x:Key="Text.Configure.CustomAction.InputControls.Edit" xml:space="preserve">Editar</x:String>
184-
<x:String x:Key="Text.Configure.CustomAction.InputControls.Tip" xml:space="preserve">Puedes usar $1, $2 ... en argumentos, para valores de los controles de entrada</x:String>
185183
<x:String x:Key="Text.Configure.CustomAction.Name" xml:space="preserve">Nombre:</x:String>
186184
<x:String x:Key="Text.Configure.CustomAction.Scope" xml:space="preserve">Alcance:</x:String>
187185
<x:String x:Key="Text.Configure.CustomAction.Scope.Branch" xml:space="preserve">Rama</x:String>

src/Resources/Locales/ru_RU.axaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,11 +177,9 @@
177177
<x:String x:Key="Text.Configure.CommitMessageTemplate.Name" xml:space="preserve">Название:</x:String>
178178
<x:String x:Key="Text.Configure.CustomAction" xml:space="preserve">ПОЛЬЗОВАТЕЛЬСКОЕ ДЕЙСТВИЕ</x:String>
179179
<x:String x:Key="Text.Configure.CustomAction.Arguments" xml:space="preserve">Аргументы:</x:String>
180-
<x:String x:Key="Text.Configure.CustomAction.Arguments.Tip" xml:space="preserve">Встроенные параметры: ${REPO} — путь к репозиторию; ${BRANCH} — выбранная ветка; ${SHA} — хеш выбранной ревизии; ${TAG} — выбранная метка</x:String>
181180
<x:String x:Key="Text.Configure.CustomAction.Executable" xml:space="preserve">Исполняемый файл:</x:String>
182181
<x:String x:Key="Text.Configure.CustomAction.InputControls" xml:space="preserve">Элементы управления вводом:</x:String>
183182
<x:String x:Key="Text.Configure.CustomAction.InputControls.Edit" xml:space="preserve">Редактор</x:String>
184-
<x:String x:Key="Text.Configure.CustomAction.InputControls.Tip" xml:space="preserve">Вы можете использовать $1, $2 ... в аргументах для значений элемента управления вводом</x:String>
185183
<x:String x:Key="Text.Configure.CustomAction.Name" xml:space="preserve">Имя:</x:String>
186184
<x:String x:Key="Text.Configure.CustomAction.Scope" xml:space="preserve">Диапазон:</x:String>
187185
<x:String x:Key="Text.Configure.CustomAction.Scope.Branch" xml:space="preserve">Ветка</x:String>

src/Resources/Locales/zh_CN.axaml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,11 +177,18 @@
177177
<x:String x:Key="Text.Configure.CommitMessageTemplate.Name" xml:space="preserve">模板名 :</x:String>
178178
<x:String x:Key="Text.Configure.CustomAction" xml:space="preserve">自定义操作</x:String>
179179
<x:String x:Key="Text.Configure.CustomAction.Arguments" xml:space="preserve">命令行参数 :</x:String>
180-
<x:String x:Key="Text.Configure.CustomAction.Arguments.Tip" xml:space="preserve">内置变量:${REPO} 仓库路径、${REMOTE} 选中的远程仓库或选中分支所属的远程仓库、${BRANCH} 选中的分支、${SHA} 选中的提交哈希,${TAG} 选中的标签</x:String>
180+
<x:String x:Key="Text.Configure.CustomAction.Arguments.Tip" xml:space="preserve">内置变量:
181+
182+
${REPO} 仓库路径
183+
${REMOTE} 选中的远程仓库或选中分支所属的远程仓库
184+
${BRANCH} 选中的分支,对于远程分支不包含远程名
185+
${BRANCH_FRIENDLY_NAME} 选中的分支,对于远程分支包含远程名
186+
${SHA} 选中的提交哈希
187+
${TAG} 选中的标签
188+
$1, $2 ... 输入控件中填写的值</x:String>
181189
<x:String x:Key="Text.Configure.CustomAction.Executable" xml:space="preserve">可执行文件路径 :</x:String>
182190
<x:String x:Key="Text.Configure.CustomAction.InputControls" xml:space="preserve">输入控件 :</x:String>
183191
<x:String x:Key="Text.Configure.CustomAction.InputControls.Edit" xml:space="preserve">编辑</x:String>
184-
<x:String x:Key="Text.Configure.CustomAction.InputControls.Tip" xml:space="preserve">请在命令行参数中使用 $1, $2 等占位符表示输入控件的值</x:String>
185192
<x:String x:Key="Text.Configure.CustomAction.Name" xml:space="preserve">名称 :</x:String>
186193
<x:String x:Key="Text.Configure.CustomAction.Scope" xml:space="preserve">作用目标 :</x:String>
187194
<x:String x:Key="Text.Configure.CustomAction.Scope.Branch" xml:space="preserve">选中的分支</x:String>

src/Resources/Locales/zh_TW.axaml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,11 +177,18 @@
177177
<x:String x:Key="Text.Configure.CommitMessageTemplate.Name" xml:space="preserve">範本名稱:</x:String>
178178
<x:String x:Key="Text.Configure.CustomAction" xml:space="preserve">自訂動作</x:String>
179179
<x:String x:Key="Text.Configure.CustomAction.Arguments" xml:space="preserve">指令參數:</x:String>
180-
<x:String x:Key="Text.Configure.CustomAction.Arguments.Tip" xml:space="preserve">內建參數: ${REPO} 存放庫路徑、${REMOTE} 所選的遠端存放庫或所選分支的遠端、${BRANCH} 所選的分支、${SHA} 所選的提交編號、${TAG} 所選的標籤</x:String>
180+
<x:String x:Key="Text.Configure.CustomAction.Arguments.Tip" xml:space="preserve">內建參數:
181+
182+
${REPO} 存放庫路徑
183+
${REMOTE} 所選的遠端存放庫或所選分支的遠端
184+
${BRANCH} 所選的分支。對於遠端分支,不包含遠端名稱
185+
${BRANCH_FRIENDLY_NAME} 所選的分支。對於遠端分支,不包含遠端名稱
186+
${SHA} 所選的提交編號
187+
${TAG} 所選的標籤
188+
$1, $2 ... 輸入控制項中的值</x:String>
181189
<x:String x:Key="Text.Configure.CustomAction.Executable" xml:space="preserve">可執行檔案路徑:</x:String>
182190
<x:String x:Key="Text.Configure.CustomAction.InputControls" xml:space="preserve">輸入控制項:</x:String>
183191
<x:String x:Key="Text.Configure.CustomAction.InputControls.Edit" xml:space="preserve">編輯</x:String>
184-
<x:String x:Key="Text.Configure.CustomAction.InputControls.Tip" xml:space="preserve">請使用 $1、$2 等變數來代表輸入控制項的值</x:String>
185192
<x:String x:Key="Text.Configure.CustomAction.Name" xml:space="preserve">名稱:</x:String>
186193
<x:String x:Key="Text.Configure.CustomAction.Scope" xml:space="preserve">執行範圍:</x:String>
187194
<x:String x:Key="Text.Configure.CustomAction.Scope.Branch" xml:space="preserve">選取的分支</x:String>

src/ViewModels/ExecuteCustomAction.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ private string PrepareStringByTarget(string org)
182182

183183
return Target switch
184184
{
185-
Models.Branch b => org.Replace("${BRANCH}", b.FriendlyName).Replace("${REMOTE}", b.Remote),
185+
Models.Branch b => org.Replace("${BRANCH_FRIENDLY_NAME}", b.FriendlyName).Replace("${BRANCH}", b.Name).Replace("${REMOTE}", b.Remote),
186186
Models.Commit c => org.Replace("${SHA}", c.SHA),
187187
Models.Tag t => org.Replace("${TAG}", t.Name),
188188
Models.Remote r => org.Replace("${REMOTE}", r.Name),

src/Views/Preferences.axaml

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -559,10 +559,10 @@
559559
<TextBlock Classes="tab_header" Text="{DynamicResource Text.Configure.CustomAction}"/>
560560
</TabItem.Header>
561561

562-
<Grid MinHeight="380" Margin="0,8,0,16">
562+
<Grid MinHeight="360" Margin="0,8,0,16">
563563
<Grid.ColumnDefinitions>
564564
<ColumnDefinition Width="200"/>
565-
<ColumnDefinition Width="*" MaxWidth="400"/>
565+
<ColumnDefinition Width="*"/>
566566
</Grid.ColumnDefinitions>
567567

568568
<Border Grid.Column="0"
@@ -659,19 +659,6 @@
659659
<ComboBoxItem Content="{DynamicResource Text.Configure.CustomAction.Scope.Remote}"/>
660660
</ComboBox>
661661

662-
<TextBlock Margin="0,12,0,0" Text="{DynamicResource Text.Configure.CustomAction.Executable}"/>
663-
<TextBox Margin="0,4,0,0" Height="28" CornerRadius="3" Text="{Binding Executable, Mode=TwoWay}">
664-
<TextBox.InnerRightContent>
665-
<Button Classes="icon_button" Width="30" Height="30" Click="SelectExecutableForCustomAction">
666-
<Path Data="{StaticResource Icons.Folder.Open}" Fill="{DynamicResource Brush.FG1}"/>
667-
</Button>
668-
</TextBox.InnerRightContent>
669-
</TextBox>
670-
671-
<TextBlock Margin="0,12,0,0" Text="{DynamicResource Text.Configure.CustomAction.Arguments}"/>
672-
<TextBox Margin="0,4,0,0" CornerRadius="3" Height="28" Text="{Binding Arguments, Mode=TwoWay}"/>
673-
<TextBlock Margin="0,2,0,0" TextWrapping="Wrap" Text="{DynamicResource Text.Configure.CustomAction.Arguments.Tip}" Foreground="{DynamicResource Brush.FG2}"/>
674-
675662
<TextBlock Margin="0,12,0,0" Text="{DynamicResource Text.Configure.CustomAction.InputControls}"/>
676663
<Button Margin="0,4,0,0" Classes="flat" Height="28" Click="EditCustomActionControls">
677664
<StackPanel Orientation="Horizontal">
@@ -682,7 +669,23 @@
682669
</Border>
683670
</StackPanel>
684671
</Button>
685-
<TextBlock Margin="0,2,0,0" TextWrapping="Wrap" Text="{DynamicResource Text.Configure.CustomAction.InputControls.Tip}" Foreground="{DynamicResource Brush.FG2}"/>
672+
673+
<TextBlock Margin="0,12,0,0" Text="{DynamicResource Text.Configure.CustomAction.Executable}"/>
674+
<TextBox Margin="0,4,0,0" Height="28" CornerRadius="3" Text="{Binding Executable, Mode=TwoWay}">
675+
<TextBox.InnerRightContent>
676+
<Button Classes="icon_button" Width="30" Height="30" Click="SelectExecutableForCustomAction">
677+
<Path Data="{StaticResource Icons.Folder.Open}" Fill="{DynamicResource Brush.FG1}"/>
678+
</Button>
679+
</TextBox.InnerRightContent>
680+
</TextBox>
681+
682+
<TextBlock Margin="0,12,0,0" Text="{DynamicResource Text.Configure.CustomAction.Arguments}"/>
683+
<Grid Margin="0,4,0,0" ColumnDefinitions="*,Auto">
684+
<TextBox Grid.Column="0" CornerRadius="3" Height="28" Text="{Binding Arguments, Mode=TwoWay}"/>
685+
<Border Grid.Column="1" Width="22" Height="28" Background="Transparent" VerticalAlignment="Center" ToolTip.Tip="{DynamicResource Text.Configure.CustomAction.Arguments.Tip}">
686+
<Path Width="14" Height="14" Data="{StaticResource Icons.Info}"/>
687+
</Border>
688+
</Grid>
686689

687690
<CheckBox Margin="0,8,0,0" Content="{DynamicResource Text.Configure.CustomAction.WaitForExit}" IsChecked="{Binding WaitForExit, Mode=TwoWay}"/>
688691
</StackPanel>

src/Views/RepositoryConfigure.axaml

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@
388388
<TextBlock Classes="tab_header" Text="{DynamicResource Text.Configure.CustomAction}"/>
389389
</TabItem.Header>
390390

391-
<Grid ColumnDefinitions="200,*" MinHeight="380" Margin="0,8,0,16">
391+
<Grid ColumnDefinitions="200,*" MinHeight="360" Margin="0,8,0,16">
392392
<Border Grid.Column="0"
393393
BorderThickness="1" BorderBrush="{DynamicResource Brush.Border2}"
394394
Background="{DynamicResource Brush.Contents}">
@@ -483,19 +483,6 @@
483483
<ComboBoxItem Content="{DynamicResource Text.Configure.CustomAction.Scope.Remote}"/>
484484
</ComboBox>
485485

486-
<TextBlock Margin="0,12,0,0" Text="{DynamicResource Text.Configure.CustomAction.Executable}"/>
487-
<TextBox Margin="0,4,0,0" Height="28" CornerRadius="3" Text="{Binding Executable, Mode=TwoWay}">
488-
<TextBox.InnerRightContent>
489-
<Button Classes="icon_button" Width="30" Height="30" Click="SelectExecutableForCustomAction">
490-
<Path Data="{StaticResource Icons.Folder.Open}" Fill="{DynamicResource Brush.FG1}"/>
491-
</Button>
492-
</TextBox.InnerRightContent>
493-
</TextBox>
494-
495-
<TextBlock Margin="0,12,0,0" Text="{DynamicResource Text.Configure.CustomAction.Arguments}"/>
496-
<TextBox Margin="0,4,0,0" CornerRadius="3" Height="28" Text="{Binding Arguments, Mode=TwoWay}"/>
497-
<TextBlock Margin="0,2,0,0" TextWrapping="Wrap" Text="{DynamicResource Text.Configure.CustomAction.Arguments.Tip}" Foreground="{DynamicResource Brush.FG2}"/>
498-
499486
<TextBlock Margin="0,12,0,0" Text="{DynamicResource Text.Configure.CustomAction.InputControls}"/>
500487
<Button Margin="0,4,0,0" Classes="flat" Height="28" Click="EditCustomActionControls">
501488
<StackPanel Orientation="Horizontal">
@@ -506,7 +493,23 @@
506493
</Border>
507494
</StackPanel>
508495
</Button>
509-
<TextBlock Margin="0,2,0,0" TextWrapping="Wrap" Text="{DynamicResource Text.Configure.CustomAction.InputControls.Tip}" Foreground="{DynamicResource Brush.FG2}"/>
496+
497+
<TextBlock Margin="0,12,0,0" Text="{DynamicResource Text.Configure.CustomAction.Executable}"/>
498+
<TextBox Margin="0,4,0,0" Height="28" CornerRadius="3" Text="{Binding Executable, Mode=TwoWay}">
499+
<TextBox.InnerRightContent>
500+
<Button Classes="icon_button" Width="30" Height="30" Click="SelectExecutableForCustomAction">
501+
<Path Data="{StaticResource Icons.Folder.Open}" Fill="{DynamicResource Brush.FG1}"/>
502+
</Button>
503+
</TextBox.InnerRightContent>
504+
</TextBox>
505+
506+
<TextBlock Margin="0,12,0,0" Text="{DynamicResource Text.Configure.CustomAction.Arguments}"/>
507+
<Grid Margin="0,4,0,0" ColumnDefinitions="*,Auto">
508+
<TextBox Grid.Column="0" CornerRadius="3" Height="28" Text="{Binding Arguments, Mode=TwoWay}"/>
509+
<Border Grid.Column="1" Width="22" Height="28" Background="Transparent" VerticalAlignment="Center" ToolTip.Tip="{DynamicResource Text.Configure.CustomAction.Arguments.Tip}">
510+
<Path Width="14" Height="14" Data="{StaticResource Icons.Info}"/>
511+
</Border>
512+
</Grid>
510513

511514
<CheckBox Margin="0,8,0,0" Content="{DynamicResource Text.Configure.CustomAction.WaitForExit}" IsChecked="{Binding WaitForExit, Mode=TwoWay}"/>
512515
</StackPanel>

0 commit comments

Comments
 (0)