refactor: external tools and shells

* rename Models.ExternalMergeTools to Models.ExternalMerger
* supports Git Bash/PowerShell/Command Prompt/Default Shell in Windows Terminal
This commit is contained in:
leo 2024-04-09 10:41:37 +08:00
parent 4ac705f8ca
commit 4882fd9d69
19 changed files with 243 additions and 152 deletions

View file

@ -21,7 +21,6 @@ namespace SourceGit.Native
}
public static string GitExecutable { get; set; } = string.Empty;
public static bool UsePowershellOnWindows { get; set; } = false;
public static List<Models.ExternalTool> ExternalTools { get; set; } = new List<Models.ExternalTool>();
static OS()
@ -46,6 +45,33 @@ namespace SourceGit.Native
ExternalTools = _backend.FindExternalTools();
}
public static Models.Shell GetShell()
{
if (OperatingSystem.IsWindows())
{
return (_backend as Windows).Shell;
}
else
{
return Models.Shell.Default;
}
}
public static bool SetShell(Models.Shell shell)
{
if (OperatingSystem.IsWindows())
{
var windows = (_backend as Windows);
if (windows.Shell != shell)
{
windows.Shell = shell;
return true;
}
}
return false;
}
public static void SetupApp(AppBuilder builder)
{
_backend.SetupApp(builder);