Files
metabuilder/frontends/cli/src/main.cpp
johndoe6345789 3d2fc07026 feat(cli): add DBAL command handlers and package management functionality
- Introduced `dbal_commands.h` for handling DBAL operations via CLI.
- Implemented `package_commands.cpp` and `package_commands.h` for package management, including listing, running scripts, and generating packages.
- Created `lua_runner.cpp` and `lua_runner.h` to execute Lua scripts in a secure sandbox environment.
- Added `http_client.cpp` and `http_client.h` for making HTTP requests to a specified base URL.
- Updated `main.cpp` to initialize the HTTP client and dispatch commands based on user input.
2026-01-07 15:28:19 +00:00

28 lines
729 B
C++

#include "commands/command_dispatch.h"
#include "utils/http_client.h"
#include <algorithm>
#include <cstdlib>
#include <iostream>
#include <string>
#include <vector>
int main(int argc, char **argv) {
std::vector<std::string> args;
args.reserve(std::max(0, argc - 1));
for (int i = 1; i < argc; ++i) {
args.emplace_back(argv[i]);
}
const char *env_base = std::getenv("METABUILDER_BASE_URL");
const std::string base_url = env_base ? env_base : "http://localhost:3000";
try {
HttpClient client(base_url);
return commands::dispatch(client, args);
} catch (const std::exception &e) {
std::cerr << "failed to create HTTP client: " << e.what() << '\n';
return 1;
}
}