Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 1eb1329

Browse files
feat: add Built-in parameters: DIRNAME, Fixes #1628
1 parent 7b75fc4 commit 1eb1329

File tree

4 files changed

+10
-4
lines changed

4 files changed

+10
-4
lines changed

‎src/Resources/Locales/en_US.axaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@
174174
<x:String x:Key="Text.Configure.CommitMessageTemplate.Name" xml:space="preserve">Template Name:</x:String>
175175
<x:String x:Key="Text.Configure.CustomAction" xml:space="preserve">CUSTOM ACTION</x:String>
176176
<x:String x:Key="Text.Configure.CustomAction.Arguments" xml:space="preserve">Arguments:</x:String>
177-
<x:String x:Key="Text.Configure.CustomAction.Arguments.Tip" xml:space="preserve">Built-in parameters: ${REPO} - repository's path; ${BRANCH} - selected branch; ${SHA} - selected commit's hash; ${TAG} - selected tag</x:String>
177+
<x:String x:Key="Text.Configure.CustomAction.Arguments.Tip" xml:space="preserve">Built-in parameters: ${REPO} - repository's path; ${DIRNAME} - repository's directory name; ${BRANCH} - selected branch; ${SHA} - selected commit's hash; ${TAG} - selected tag</x:String>
178178
<x:String x:Key="Text.Configure.CustomAction.Executable" xml:space="preserve">Executable File:</x:String>
179179
<x:String x:Key="Text.Configure.CustomAction.InputControls" xml:space="preserve">Input Controls:</x:String>
180180
<x:String x:Key="Text.Configure.CustomAction.InputControls.Edit" xml:space="preserve">Edit</x:String>

‎src/Resources/Locales/zh_CN.axaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@
178178
<x:String x:Key="Text.Configure.CommitMessageTemplate.Name" xml:space="preserve">模板名 :</x:String>
179179
<x:String x:Key="Text.Configure.CustomAction" xml:space="preserve">自定义操作</x:String>
180180
<x:String x:Key="Text.Configure.CustomAction.Arguments" xml:space="preserve">命令行参数 :</x:String>
181-
<x:String x:Key="Text.Configure.CustomAction.Arguments.Tip" xml:space="preserve">内置变量:${REPO} 仓库路径、${BRANCH} 选中的分支、${SHA} 选中的提交哈希,${TAG} 选中的标签</x:String>
181+
<x:String x:Key="Text.Configure.CustomAction.Arguments.Tip" xml:space="preserve">内置变量:${REPO} 仓库路径、${DIRNAME} 仓库文件夹名、${BRANCH} 选中的分支、${SHA} 选中的提交哈希,${TAG} 选中的标签</x:String>
182182
<x:String x:Key="Text.Configure.CustomAction.Executable" xml:space="preserve">可执行文件路径 :</x:String>
183183
<x:String x:Key="Text.Configure.CustomAction.InputControls" xml:space="preserve">输入控件 :</x:String>
184184
<x:String x:Key="Text.Configure.CustomAction.InputControls.Edit" xml:space="preserve">编辑</x:String>

‎src/Resources/Locales/zh_TW.axaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@
178178
<x:String x:Key="Text.Configure.CommitMessageTemplate.Name" xml:space="preserve">範本名稱:</x:String>
179179
<x:String x:Key="Text.Configure.CustomAction" xml:space="preserve">自訂動作</x:String>
180180
<x:String x:Key="Text.Configure.CustomAction.Arguments" xml:space="preserve">指令參數:</x:String>
181-
<x:String x:Key="Text.Configure.CustomAction.Arguments.Tip" xml:space="preserve">內建參數: ${REPO} 存放庫路徑、${BRANCH} 所選的分支、${SHA} 所選的提交編號、${TAG} 所選的標籤</x:String>
181+
<x:String x:Key="Text.Configure.CustomAction.Arguments.Tip" xml:space="preserve">內建參數: ${REPO} 存放庫路徑、${DIRNAME} 存放庫資料夾名、${BRANCH} 所選的分支、${SHA} 所選的提交編號、${TAG} 所選的標籤</x:String>
182182
<x:String x:Key="Text.Configure.CustomAction.Executable" xml:space="preserve">可執行檔案路徑:</x:String>
183183
<x:String x:Key="Text.Configure.CustomAction.InputControls" xml:space="preserve">輸入控件:</x:String>
184184
<x:String x:Key="Text.Configure.CustomAction.InputControls.Edit" xml:space="preserve">編輯</x:String>

‎src/ViewModels/ExecuteCustomAction.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,13 +203,14 @@ private void PrepareControlParameters()
203203
private string PrepareStringByTarget(string org)
204204
{
205205
org = org.Replace("${REPO}", GetWorkdir());
206+
org = org.Replace("${DIRNAME}", GetWorkdirname());
206207

207208
return Target switch
208209
{
209210
Models.Branch b => org.Replace("${BRANCH}", b.FriendlyName),
210211
Models.Commit c => org.Replace("${SHA}", c.SHA),
211212
Models.Tag t => org.Replace("${TAG}", t.Name),
212-
_ => org
213+
_ => org,
213214
};
214215
}
215216

@@ -218,6 +219,11 @@ private string GetWorkdir()
218219
return OperatingSystem.IsWindows() ? _repo.FullPath.Replace("/", "\\") : _repo.FullPath;
219220
}
220221

222+
private string GetWorkdirname()
223+
{
224+
return _repo.FullPath.Replace("\\", "/").Split('/')[^1];
225+
}
226+
221227
private void Run(string args)
222228
{
223229
var start = new ProcessStartInfo();

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /