bootstrap

Signed-off-by: faumaray <faumaray@gmail.com>
This commit is contained in:
faumaray committed 2026-11-25 02:11:19 +03:00
commit ca04975d54
62 files changed
+3381

No files matched your search

+39
View File
@@ -0,0 +1,39 @@
#include <vls/Server.hpp>
#include <Void/Configuration/Argparse.hpp>
#include <csignal>
#include <iostream>
#include <string_view>
int main(int argc, char **argv) {
bool stdio = false;
bool version = false;
Void::Argparse::Parser parser{
"vls", "VoidLanguageServer 0.1.0: stdio LSP lifecycle shell.\n"
"No arguments starts stdio. Language and debugger features are planned."};
parser.flag("--stdio", "", "run the stdio LSP lifecycle shell", stdio);
parser.flag("--version", "-V", "show version", version);
if (argc == 2 && (std::string_view{argv[1]} == "--help" || std::string_view{argv[1]} == "-h")) {
std::cout << parser.help();
return std::cout ? 0 : 1;
}
// Each mode is standalone. This also rejects duplicate flags deterministically.
if (argc > 2) {
std::cerr << "vls: options must be used alone; use --help\n";
return 2;
}
const auto parsed = parser.parse(argc, argv);
if (!parsed) {
std::cerr << "vls: " << parsed.error() << '\n';
return 2;
}
if (version) {
std::cout << "VoidLanguageServer " << vls::server_version << '\n';
return std::cout ? 0 : 1;
}
#ifdef SIGPIPE
std::signal(SIGPIPE, SIG_IGN);
#endif
return vls::run_stdio(std::cin, std::cout, std::cerr);
}