Add realization open editor
This commit is contained in:
parent
82cc4d0f6f
commit
7487bab9ae
|
@ -1,9 +1,22 @@
|
|||
#include <utils/editor.hpp>
|
||||
|
||||
#define SIGPIPE_ALWAYS_IGNORE
|
||||
#include <cppshell/shell.hpp>
|
||||
#undef SIGPIPE_ALWAYS_IGNORE
|
||||
|
||||
#include <iostream>
|
||||
|
||||
namespace utils {
|
||||
void OpenEditor(const std::string& file) {
|
||||
std::cout << "Open file " << file << " TODO" << std::endl;
|
||||
}
|
||||
std::string editors[] = {"nvim", "vim", "vi"};
|
||||
|
||||
cppshell::Shell shell;
|
||||
|
||||
for (auto& editor : editors) {
|
||||
shell.Execute(editor + " " + file);
|
||||
if (shell.GetExitCodeLastCommand() == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace utils
|
||||
|
|
Loading…
Reference in a new issue