3void PreprocessorList::print_containers(std::vector<ContainerInfo>& containers) {
4 size_t color_offset = no_color ? 0 :10;
6 << std::setw(29 + color_offset) <<
BOLD(
"CACHE CONTAINER") <<
" "
7 << std::setw(12 + color_offset) <<
BOLD(
"ID") <<
" "
8 << std::setw(10 + color_offset) <<
BOLD(
"DISK USAGE") <<
" "
12 for (
const auto& container : containers) {
13 std::cout << std::left << std::setw(29 + color_offset + color_offset) <<
BOLD(
BLUE(container.name)) <<
" "
14 << std::left << std::setw(12) << container.id <<
" "
15 << std::right << std::setw(10) << container.disk_usage <<
" "
16 << std::left << container.extra
24 no_color =
options.args.count(
"no-color") > 0;
31 std::vector<ContainerInfo> containers;
33 for (
const auto& entry : fs::directory_iterator(base_path)) {
34 if (!fs::is_directory(entry))
continue;
37 container.
name = entry.path().filename().string();
41 containers.push_back(container);
44 print_containers(containers);
const CliOption * options() const final
static Config & config()
Gets the singleton configuration instance.
fs::path base_path
Default base path for temporary files.
bool run(const ParsedOptions &options) override
Executes the main logic of the command.
bool validate(const ParsedOptions &options) override
Validate the arguments already analyzed.
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.