mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Misc
This commit is contained in:
parent
be5fd86aa7
commit
747d97ecfc
1 changed files with 37 additions and 32 deletions
|
|
@ -80,7 +80,7 @@ namespace Wox.Plugin.CMD
|
||||||
IcoPath = Image,
|
IcoPath = Image,
|
||||||
Action = c =>
|
Action = c =>
|
||||||
{
|
{
|
||||||
ExecuteCommand(m);
|
Execute(m);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
@ -113,7 +113,7 @@ namespace Wox.Plugin.CMD
|
||||||
IcoPath = Image,
|
IcoPath = Image,
|
||||||
Action = c =>
|
Action = c =>
|
||||||
{
|
{
|
||||||
ExecuteCommand(m.Key);
|
Execute(m.Key);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -132,7 +132,7 @@ namespace Wox.Plugin.CMD
|
||||||
IcoPath = Image,
|
IcoPath = Image,
|
||||||
Action = c =>
|
Action = c =>
|
||||||
{
|
{
|
||||||
ExecuteCommand(cmd);
|
Execute(cmd);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -150,14 +150,14 @@ namespace Wox.Plugin.CMD
|
||||||
IcoPath = Image,
|
IcoPath = Image,
|
||||||
Action = c =>
|
Action = c =>
|
||||||
{
|
{
|
||||||
ExecuteCommand(m.Key);
|
Execute(m.Key);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}).Take(5);
|
}).Take(5);
|
||||||
return history.ToList();
|
return history.ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ExecuteCommand(string command, bool runAsAdministrator = false)
|
private void Execute(string command, bool runAsAdministrator = false)
|
||||||
{
|
{
|
||||||
command = command.Trim();
|
command = command.Trim();
|
||||||
command = Environment.ExpandEnvironmentVariables(command);
|
command = Environment.ExpandEnvironmentVariables(command);
|
||||||
|
|
@ -172,32 +172,7 @@ namespace Wox.Plugin.CMD
|
||||||
Arguments = arguments,
|
Arguments = arguments,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
else if (_settings.Shell == Shell.RunCommand)
|
else if (_settings.Shell == Shell.Powershell)
|
||||||
{
|
|
||||||
var parts = command.Split(new[] { ' ' }, 2);
|
|
||||||
if (parts.Length == 1)
|
|
||||||
{
|
|
||||||
info = new ProcessStartInfo(command);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
var filename = parts[0];
|
|
||||||
if (ExistInPath(filename))
|
|
||||||
{
|
|
||||||
info = new ProcessStartInfo(command);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
var arguemtns = parts[1];
|
|
||||||
info = new ProcessStartInfo
|
|
||||||
{
|
|
||||||
FileName = filename,
|
|
||||||
Arguments = arguemtns
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
string arguments;
|
string arguments;
|
||||||
if (_settings.LeaveShellOpen)
|
if (_settings.LeaveShellOpen)
|
||||||
|
|
@ -214,6 +189,36 @@ namespace Wox.Plugin.CMD
|
||||||
Arguments = arguments
|
Arguments = arguments
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
else if (_settings.Shell == Shell.RunCommand)
|
||||||
|
{
|
||||||
|
var parts = command.Split(new[] {' '}, 2);
|
||||||
|
if (parts.Length == 2)
|
||||||
|
{
|
||||||
|
var filename = parts[0];
|
||||||
|
if (ExistInPath(filename))
|
||||||
|
{
|
||||||
|
var arguemtns = parts[1];
|
||||||
|
info = new ProcessStartInfo
|
||||||
|
{
|
||||||
|
FileName = filename,
|
||||||
|
Arguments = arguemtns
|
||||||
|
};
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
info = new ProcessStartInfo(command);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
info = new ProcessStartInfo(command);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
info.UseShellExecute = true;
|
info.UseShellExecute = true;
|
||||||
info.WorkingDirectory = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
|
info.WorkingDirectory = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
|
||||||
|
|
@ -318,7 +323,7 @@ namespace Wox.Plugin.CMD
|
||||||
Action = c =>
|
Action = c =>
|
||||||
{
|
{
|
||||||
context.API.HideApp();
|
context.API.HideApp();
|
||||||
ExecuteCommand(selectedResult.Title, true);
|
Execute(selectedResult.Title, true);
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
IcoPath = Image
|
IcoPath = Image
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue