Add project files
This commit is contained in:
commit
f2fe6b8855
114 files changed
+20525
No files matched your search
@@ -0,0 +1,57 @@
|
||||
#pragma once
|
||||
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "breeze/Project.hpp"
|
||||
|
||||
/// Tools: extensions a project installs from a repository. A tool is a git repository (or, while it
|
||||
/// is being written, a directory) with a `breeze-tool.json` at its root:
|
||||
///
|
||||
/// { "id": "resembed", "version": "1.0.0", "description": "...", "entry": "bin/resembed.sh" }
|
||||
///
|
||||
/// `entry` may instead be { "posix": "...", "windows": "..." }. Installed, a tool is copied into
|
||||
/// <project>/.breeze/tools/<id>/ and recorded in .breeze/tools.json (meant to be committed). From
|
||||
/// then on `breeze tool <id> <arguments...>` runs its entry with those arguments, in the project's
|
||||
/// directory, with the project described in environment variables (BREEZE_PROJECT_ROOT,
|
||||
/// BREEZE_SDK_DIR, BREEZE_SDK_VERSION, BREEZE_TOOL_ID, BREEZE_TOOL_DIR, BREEZE_CLI, BREEZE_EDITOR).
|
||||
/// What commands a tool offers, and what they do, is entirely up to the tool.
|
||||
namespace breeze::tools
|
||||
{
|
||||
|
||||
struct Tool
|
||||
{
|
||||
std::string id;
|
||||
std::string version;
|
||||
std::string repo;
|
||||
std::string description;
|
||||
std::filesystem::path dir;
|
||||
};
|
||||
|
||||
/// The words after `breeze tool` that belong to the CLI itself and can't be tool ids.
|
||||
bool isReservedName(const std::string& word);
|
||||
|
||||
std::vector<Tool> installed(const Project& project);
|
||||
|
||||
/// Installs the newest version of the tool in `repo`.
|
||||
void install(const Project& project, const std::string& repo);
|
||||
void uninstall(const Project& project, const std::string& id);
|
||||
|
||||
/// Reports whether newer versions of the tool exist.
|
||||
void update(const Project& project, const std::string& id);
|
||||
|
||||
/// Moves the tool to its newest version with the same major version.
|
||||
void upgrade(const Project& project, const std::string& id);
|
||||
|
||||
/// Moves the tool to exactly this version.
|
||||
void migrate(const Project& project, const std::string& id, const std::string& version);
|
||||
|
||||
void list(const Project& project);
|
||||
|
||||
/// Runs the tool's entry with `args`; the entry's exit code, or nullopt when no such tool is
|
||||
/// installed.
|
||||
std::optional<int> run(const Project& project, const std::string& id,
|
||||
const std::vector<std::string>& args);
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user