44 lines
1.4 KiB
C++
44 lines
1.4 KiB
C++
#pragma once
|
|
|
|
#include <filesystem>
|
|
#include <optional>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include "breeze/Version.hpp"
|
|
|
|
/// The CLI managing itself: which versions of it are installed, which one is picked, and running
|
|
/// the picked one. Versions live in <breeze home>/cli/<version>/; `cli/current` names the picked
|
|
/// one, and <breeze home>/bin/breeze is the copy to put on PATH. Whatever `breeze` the shell finds
|
|
/// hands the command to the picked version, so installing or picking never means changing PATH
|
|
/// again.
|
|
namespace breeze::self
|
|
{
|
|
|
|
/// The version of this program.
|
|
std::string version();
|
|
|
|
/// Installed versions, oldest first.
|
|
std::vector<Version> installed();
|
|
|
|
/// The version `cli pick` chose, if any.
|
|
std::optional<Version> picked();
|
|
|
|
/// Installs a version: this very program if that is its version, else a release of the
|
|
/// configured CLI source. The first version installed is picked.
|
|
void install(const std::string& version);
|
|
|
|
void pick(const std::string& version);
|
|
|
|
/// Removes a version; un-picks it if it was the picked one.
|
|
void uninstall(const std::string& version);
|
|
|
|
/// Prints the installed versions, marking the picked one and the running one.
|
|
void list();
|
|
|
|
/// If another version is picked, installed and runnable, runs it with `args` and does not
|
|
/// return. `cli ...` commands always run in the version that was started.
|
|
void forwardToPicked(const std::vector<std::string>& args);
|
|
|
|
}
|