mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-11-01 13:13:21 -07:00
enhance: add -WorkingDirectory and -Nologo arguments for PowerShell
This commit is contained in:
parent
4882fd9d69
commit
a3c81745aa
1 changed files with 9 additions and 11 deletions
|
@ -149,16 +149,13 @@ namespace SourceGit.Native
|
||||||
|
|
||||||
public void OpenTerminal(string workdir)
|
public void OpenTerminal(string workdir)
|
||||||
{
|
{
|
||||||
var startInfo = new ProcessStartInfo();
|
if (string.IsNullOrEmpty(workdir) || !Path.Exists(workdir))
|
||||||
|
{
|
||||||
|
workdir = ".";
|
||||||
|
}
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(workdir) && Path.Exists(workdir))
|
var startInfo = new ProcessStartInfo();
|
||||||
{
|
startInfo.WorkingDirectory = workdir;
|
||||||
startInfo.WorkingDirectory = workdir;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
startInfo.WorkingDirectory = ".";
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (Shell)
|
switch (Shell)
|
||||||
{
|
{
|
||||||
|
@ -167,7 +164,7 @@ namespace SourceGit.Native
|
||||||
var bash = Path.Combine(binDir, "bash.exe");
|
var bash = Path.Combine(binDir, "bash.exe");
|
||||||
if (!File.Exists(bash))
|
if (!File.Exists(bash))
|
||||||
{
|
{
|
||||||
App.RaiseException(string.IsNullOrEmpty(workdir) ? "" : workdir, $"Can NOT found bash.exe under '{binDir}'");
|
App.RaiseException(workdir, $"Can NOT found bash.exe under '{binDir}'");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -175,6 +172,7 @@ namespace SourceGit.Native
|
||||||
break;
|
break;
|
||||||
case Models.Shell.PowerShell:
|
case Models.Shell.PowerShell:
|
||||||
startInfo.FileName = _powershellPath;
|
startInfo.FileName = _powershellPath;
|
||||||
|
startInfo.Arguments = $"-WorkingDirectory \"{workdir}\" -Nologo";
|
||||||
break;
|
break;
|
||||||
case Models.Shell.CommandPrompt:
|
case Models.Shell.CommandPrompt:
|
||||||
startInfo.FileName = "cmd";
|
startInfo.FileName = "cmd";
|
||||||
|
@ -183,7 +181,7 @@ namespace SourceGit.Native
|
||||||
startInfo.FileName = "wt";
|
startInfo.FileName = "wt";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
App.RaiseException(string.IsNullOrEmpty(workdir) ? "" : workdir, $"Bad shell configuration!");
|
App.RaiseException(workdir, $"Bad shell configuration!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue