Crafter.Debug/implementations/main.cpp

26 lines
1.1 KiB
C++
Raw Normal View History

// SPDX-License-Identifier: LGPL-3.0-only
// SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts®
// crafter-debug: Cli::Run with the real transport.
import std;
import Crafter.Debug.Core;
import Crafter.Debug.Cli;
using namespace Crafter::Debug;
namespace {
// Until the QUIC transport lands: every call reports it unreachable.
class Unbuilt : public Cli::Connection {
public:
std::expected<Value, Cli::CallError> Call(const Value&, std::chrono::milliseconds, const std::function<bool(const Value&)>&) override {
return std::unexpected(Cli::CallError{ Cli::CallError::Kind::Unreachable, "this client was built without its transport" });
}
};
}
int main(int argc, char** argv) {
const std::vector<std::string_view> args(argv + 1, argv + argc);
Cli::Environment environment;
environment.connect = [](const InstanceRecord&) -> std::unique_ptr<Cli::Connection> { return std::make_unique<Unbuilt>(); };
environment.haveLldb = [] { return std::filesystem::exists("/app/bin/lldb") || std::filesystem::exists("/usr/bin/lldb"); };
return Cli::Run(args, environment);
}