diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml
index 655dc0cd8..f4d9f73fb 100644
--- a/src/Resources/Locales/en_US.axaml
+++ b/src/Resources/Locales/en_US.axaml
@@ -174,7 +174,7 @@
Template Name:
CUSTOM ACTION
Arguments:
- Built-in parameters: ${REPO} - repository's path; ${BRANCH} - selected branch; ${SHA} - selected commit's hash; ${TAG} - selected tag
+ Built-in parameters: ${REPO} - repository's path; ${DIRNAME} - repository's directory name; ${BRANCH} - selected branch; {CURRENT_BRANCH} - current branch; ${SHA} - selected commit's hash; ${TAG} - selected tag
Executable File:
Input Controls:
Edit
diff --git a/src/Resources/Locales/zh_CN.axaml b/src/Resources/Locales/zh_CN.axaml
index f18372fd5..763c8bf3a 100644
--- a/src/Resources/Locales/zh_CN.axaml
+++ b/src/Resources/Locales/zh_CN.axaml
@@ -178,7 +178,7 @@
模板名 :
自定义操作
命令行参数 :
- 内置变量:${REPO} 仓库路径、${BRANCH} 选中的分支、${SHA} 选中的提交哈希,${TAG} 选中的标签
+ 内置变量:${REPO} 仓库路径、${DIRNAME} 仓库文件夹名、${BRANCH} 选中的分支、${CURRENT_BRANCH} 当前的分支、${SHA} 选中的提交哈希,${TAG} 选中的标签
可执行文件路径 :
输入控件 :
编辑
diff --git a/src/Resources/Locales/zh_TW.axaml b/src/Resources/Locales/zh_TW.axaml
index daf0caec4..909426a6f 100644
--- a/src/Resources/Locales/zh_TW.axaml
+++ b/src/Resources/Locales/zh_TW.axaml
@@ -178,7 +178,7 @@
範本名稱:
自訂動作
指令參數:
- 內建參數: ${REPO} 存放庫路徑、${BRANCH} 所選的分支、${SHA} 所選的提交編號、${TAG} 所選的標籤
+ 內建參數: ${REPO} 存放庫路徑、${DIRNAME} 存放庫資料夾名、${BRANCH} 所選的分支、${CURRENT_BRANCH} 當前分支、${SHA} 所選的提交編號、${TAG} 所選的標籤
可執行檔案路徑:
輸入控件:
編輯
diff --git a/src/ViewModels/ExecuteCustomAction.cs b/src/ViewModels/ExecuteCustomAction.cs
index fb0f2f819..3cb293b42 100644
--- a/src/ViewModels/ExecuteCustomAction.cs
+++ b/src/ViewModels/ExecuteCustomAction.cs
@@ -203,13 +203,15 @@ private void PrepareControlParameters()
private string PrepareStringByTarget(string org)
{
org = org.Replace("${REPO}", GetWorkdir());
+ org = org.Replace("${DIRNAME}", GetWorkdirname());
+ org = org.Replace("${CURRENT_BRANCH}", GetCurrentBranch());
return Target switch
{
Models.Branch b => org.Replace("${BRANCH}", b.FriendlyName),
Models.Commit c => org.Replace("${SHA}", c.SHA),
Models.Tag t => org.Replace("${TAG}", t.Name),
- _ => org
+ _ => org,
};
}
@@ -218,6 +220,16 @@ private string GetWorkdir()
return OperatingSystem.IsWindows() ? _repo.FullPath.Replace("/", "\\") : _repo.FullPath;
}
+ private string GetWorkdirname()
+ {
+ return _repo.FullPath.Replace("\\", "/").Split('/')[^1];
+ }
+
+ private string GetCurrentBranch()
+ {
+ return _repo.CurrentBranch?.FriendlyName ?? string.Empty;
+ }
+
private void Run(string args)
{
var start = new ProcessStartInfo();