Skip to content

Commit 07f4407

Browse files
committed
Fix one more whitespace after commands
1 parent 58a47aa commit 07f4407

File tree

1 file changed

+19
-5
lines changed
  • Plugins/Flow.Launcher.Plugin.Shell

1 file changed

+19
-5
lines changed

Plugins/Flow.Launcher.Plugin.Shell/Main.cs

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -194,10 +194,12 @@ private ProcessStartInfo PrepareProcessStartInfo(string command, bool runAsAdmin
194194
var workingDirectory = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
195195
var runAsAdministratorArg = !runAsAdministrator && !_settings.RunAsAdministrator ? "" : "runas";
196196

197-
ProcessStartInfo info = new()
197+
var info = new ProcessStartInfo()
198198
{
199-
Verb = runAsAdministratorArg, WorkingDirectory = workingDirectory,
199+
Verb = runAsAdministratorArg,
200+
WorkingDirectory = workingDirectory,
200201
};
202+
var notifyStr = Context.API.GetTranslation("flowlauncher_plugin_cmd_press_any_key_to_close");
201203
switch (_settings.Shell)
202204
{
203205
case Shell.Cmd:
@@ -212,7 +214,11 @@ private ProcessStartInfo PrepareProcessStartInfo(string command, bool runAsAdmin
212214
info.FileName = "cmd.exe";
213215
}
214216

215-
info.ArgumentList.Add($"{(_settings.LeaveShellOpen ? "/k" : "/c")} {command} {(_settings.CloseShellAfterPress ? $"&& echo {Context.API.GetTranslation("flowlauncher_plugin_cmd_press_any_key_to_close")} && pause > nul /c" : "")}");
217+
info.ArgumentList.Add(
218+
$"{(_settings.LeaveShellOpen ? "/k" : "/c")} {command}" +
219+
$"{(_settings.CloseShellAfterPress ?
220+
$" && echo {notifyStr} && pause > nul /c" :
221+
"")}");
216222
break;
217223
}
218224

@@ -238,7 +244,11 @@ private ProcessStartInfo PrepareProcessStartInfo(string command, bool runAsAdmin
238244
else
239245
{
240246
info.ArgumentList.Add("-Command");
241-
info.ArgumentList.Add($"{command}{addedCharacter}; {(_settings.CloseShellAfterPress ? $"Write-Host '{Context.API.GetTranslation("flowlauncher_plugin_cmd_press_any_key_to_close")}'{addedCharacter}; [System.Console]::ReadKey(){addedCharacter}; exit" : "")}");
247+
info.ArgumentList.Add(
248+
$"{command}{addedCharacter};" +
249+
$"{(_settings.CloseShellAfterPress ?
250+
$" Write-Host '{notifyStr}'{addedCharacter}; [System.Console]::ReadKey(){addedCharacter}; exit" :
251+
"")}");
242252
}
243253
break;
244254
}
@@ -262,7 +272,11 @@ private ProcessStartInfo PrepareProcessStartInfo(string command, bool runAsAdmin
262272
info.ArgumentList.Add("-NoExit");
263273
}
264274
info.ArgumentList.Add("-Command");
265-
info.ArgumentList.Add($"{command}{addedCharacter}; {(_settings.CloseShellAfterPress ? $"Write-Host '{Context.API.GetTranslation("flowlauncher_plugin_cmd_press_any_key_to_close")}'{addedCharacter}; [System.Console]::ReadKey(){addedCharacter}; exit" : "")}");
275+
info.ArgumentList.Add(
276+
$"{command}{addedCharacter};" +
277+
$"{(_settings.CloseShellAfterPress ?
278+
$" Write-Host '{notifyStr}'{addedCharacter}; [System.Console]::ReadKey(){addedCharacter}; exit" :
279+
"")}");
266280
break;
267281
}
268282

0 commit comments

Comments
 (0)