Debian Codegraph @

CodeLite/clConsoleAlacritty.cpp

raw
1 #include "clConsoleAlacritty.hpp"
2
3 #include "Platform.hpp"
4
5 clConsoleAlacritty::clConsoleAlacritty() { ThePlatform->Which("alacritty", &m_terminal); }
6
7 clConsoleAlacritty::~clConsoleAlacritty() {}
8
9 bool clConsoleAlacritty::StartForDebugger() { return false; }
10 bool clConsoleAlacritty::Start() { return StartProcess(PrepareCommand()); }
11 wxString clConsoleAlacritty::PrepareCommand()
12 {
13 // no args? just return the cmd command
14 const wxString& command = GetCommand();
15 if(command.empty() || m_terminal.empty()) {
16 return m_terminal;
17 }
18 wxString commandToExecute;
19 if(IsTerminalNeeded()) {
20 // Build the command to execute
21 commandToExecute = WrapWithQuotesIfNeeded(m_terminal);
22
23 // if "wait-when-done" enabled, wrap the command with codelite-exec
24 if(IsWaitWhenDone()) {
25 commandToExecute << " --hold";
26 }
27
28 if(!GetWorkingDirectory().empty()) {
29 commandToExecute << " --working-directory " << WrapWithQuotesIfNeeded(GetWorkingDirectory());
30 }
31
32 commandToExecute << " --title " << WrapWithQuotesIfNeeded(command);
33
34 // append the command to run
35 commandToExecute << " --command " << WrapWithQuotesIfNeeded(command);
36 if(!GetCommandArgs().IsEmpty()) {
37 commandToExecute << " " << GetCommandArgs();
38 }
39 } else {
40 commandToExecute = WrapWithQuotesIfNeeded(command);
41 if(!GetCommandArgs().IsEmpty()) {
42 commandToExecute << " " << GetCommandArgs();
43 }
44 }
45 return commandToExecute;
46 }