6void PreprocessorList::print_containers(std::vector<ContainerInfo>& containers) {
7 size_t color_offset = no_color ? 0 :10;
9 << std::setw(29 + color_offset) <<
BOLD(
"CACHE CONTAINER") <<
" "
10 << std::setw(12 + color_offset) <<
BOLD(
"ID") <<
" "
11 << std::setw(10 + color_offset) <<
BOLD(
"DISK USAGE") <<
" "
15 for (
const auto& container : containers) {
16 std::cout << std::left << std::setw(29 + color_offset + color_offset) <<
BOLD(
BLUE(container.name)) <<
" "
17 << std::left << std::setw(12) << container.id <<
" "
18 << std::right << std::setw(10) << container.disk_usage <<
" "
19 << std::left << container.extra
27 no_color =
options.has(
"no-color");
34 std::vector<ContainerInfo> containers;
36 for (
const auto& entry : fs::directory_iterator(base_path)) {
37 if (!fs::is_directory(entry))
continue;
40 container.
name = entry.path().filename().string();
48 if (params.size <= 0) {
52 auto version = !params.version.empty() ?
"v" + params.version :
"";
54 version =
RED(version);
57 container.
extra = version;
58 containers.push_back(container);
61 print_containers(containers);
const CliOption * options() const final
static Config & config()
Gets the singleton configuration instance.
static PreprocessRunParams read_current_run_params()
read preprocessing parameters runs
static bool is_cache_compatible(const std::string &cache_version)
bool run(const ParsedOptions &options) override
Executes the main logic of the command.
bool validate(const ParsedOptions &options) override
Validate the arguments already analyzed.
Configuration management interface.
std::string format_size(std::uintmax_t bytes)
Formats a byte size into a human-readable string.
std::uintmax_t folder_size(const fs::path &folder)
Calculates the total size of all regular files in a folder.
std::string hash(const std::string &content)
Computes a simple hash of a string.
Interface for listing preprocessors in the system.
Container metadata representation.
std::string name
Container name.
std::string extra
Additional info.
std::string id
Unique container ID.
std::string disk_usage
Human-readable disk usage.
std::filesystem::path base_path
Default base path for temporary files.
std::filesystem::path name_container
Name of the cache container.