diff --git a/resources/help.txt b/resources/help.txt index 94c49a61..5e828970 100644 --- a/resources/help.txt +++ b/resources/help.txt @@ -10,7 +10,7 @@ Commands: --help, -h Displays this help text. --version, -v Displays Bloom's version number. --version-machine Outputs Bloom's version number in JSON format. - --target-list-machine Outputs all targets and their configuration values, supported by this build, in JSON format. + --capabilities-machine Outputs the capabilities of this build, in JSON format. init Creates a new Bloom project configuration file (bloom.yaml), in the working directory. For more information on getting started with Bloom, please visit https://bloom.oscillate.io/docs/getting-started. diff --git a/src/Application.cpp b/src/Application.cpp index 4dbcae9e..980232b0 100644 --- a/src/Application.cpp +++ b/src/Application.cpp @@ -123,8 +123,8 @@ std::map> Application::getCommandHandlersByCom std::bind(&Application::initProject, this) }, { - "--target-list-machine", - std::bind(&Application::presentTargetListMachine, this) + "--capabilities-machine", + std::bind(&Application::presentCapabilitiesMachine, this) }, }; } @@ -375,11 +375,6 @@ int Application::presentVersionText() { int Application::presentVersionMachineText() { Logger::silence(); - auto insightAvailable = true; -#ifdef EXCLUDE_INSIGHT - insightAvailable = false; -#endif - std::cout << QJsonDocument(QJsonObject({ {"version", QString::fromStdString(Application::VERSION.toString())}, {"components", QJsonObject({ @@ -387,13 +382,12 @@ int Application::presentVersionMachineText() { {"minor", Application::VERSION.minor}, {"patch", Application::VERSION.patch}, })}, - {"insightAvailable", insightAvailable}, })).toJson().toStdString(); return EXIT_SUCCESS; } -int Application::presentTargetListMachine() { +int Application::presentCapabilitiesMachine() { using Targets::TargetFamily; Logger::silence(); @@ -403,17 +397,24 @@ int Application::presentTargetListMachine() { {TargetFamily::RISC_V, "RISC-V"}, }); - auto output = QJsonArray(); + auto supportedTargets = QJsonArray(); for (const auto& [configValue, descriptor] : Targets::TargetDescription::TargetDescriptionFile::mapping()) { - output.push_back(QJsonObject({ + supportedTargets.push_back(QJsonObject({ {"name" , QString::fromStdString(descriptor.targetName)}, {"family" , targetFamilyNames.at(descriptor.targetFamily)}, {"configurationValue" , QString::fromStdString(configValue)}, })); } - std::cout << QJsonDocument(output).toJson().toStdString(); + std::cout << QJsonDocument(QJsonObject({ + {"supportedTargets", supportedTargets}, +#ifndef EXCLUDE_INSIGHT + {"insight", true}, +#else + {"insight", false}, +#endif + })).toJson().toStdString(); return EXIT_SUCCESS; } diff --git a/src/Application.hpp b/src/Application.hpp index 8d9d4031..fc88bc18 100644 --- a/src/Application.hpp +++ b/src/Application.hpp @@ -217,11 +217,11 @@ private: int presentVersionMachineText(); /** - * Lists all supported targets, in JSON format. + * Presents Bloom's capabilities, in JSON format. * * @return */ - int presentTargetListMachine(); + int presentCapabilitiesMachine(); /** * Initialises a project in the user's working directory.