pmt: switch builder to ninja. And some extra improvements

This commit is contained in:
2025-08-27 22:04:06 +03:00
parent e0f0b5b484
commit 41336609fa
8 changed files with 82 additions and 15 deletions

View File

@@ -56,15 +56,10 @@ INIT(infoFunction) {
RUN(infoFunction) {
if (partitions.back() == "get-all" || partitions.back() == "getvar-all") {
partitions.clear();
const auto parts = Variables->PartMap->getPartitionList();
if (!parts)
if (!Variables->PartMap->copyPartitionsToVector(partitions))
throw Error("Cannot get list of all partitions! See logs for more "
"information (%s)",
Helper::LoggingProperties::FILE.data());
for (const auto &name : *parts)
partitions.push_back(name);
}
std::vector<PartitionMap::Partition_t> jParts;

View File

@@ -19,7 +19,7 @@ Copyright 2025 Yağız Zengin
#define SFUN "partitionSizeFunction"
std::string convertTo(const uint64_t size, const std::string &multiple) {
static std::string convertTo(const uint64_t size, const std::string &multiple) {
if (multiple == "KB") return std::to_string(TO_KB(size));
if (multiple == "MB") return std::to_string(TO_MB(size));
if (multiple == "GB") return std::to_string(TO_GB(size));
@@ -31,7 +31,10 @@ INIT(partitionSizeFunction) {
LOGN(SFUN, INFO)
<< "Initializing variables of partition size getter function."
<< std::endl;
cmd = _app.add_subcommand("sizeof", "Tell size(s) of input partition list");
cmd = _app.add_subcommand("sizeof", "Tell size(s) of input partition list")
->footer("Use get-all or getvar-all as partition name for getting "
"sizes of all "
"partitions.");
cmd->add_option("partition(s)", partitions, "Partition name(s).")
->required()
->delimiter(',');
@@ -55,6 +58,13 @@ INIT(partitionSizeFunction) {
}
RUN(partitionSizeFunction) {
if (partitions.back() == "get-all" || partitions.back() == "getvar-all") {
if (!Variables->PartMap->copyPartitionsToVector(partitions))
throw Error("Cannot get list of all partitions! See logs for more "
"information (%s)",
Helper::LoggingProperties::FILE.data());
}
for (const auto &partition : partitions) {
if (!Variables->PartMap->hasPartition(partition))
throw Error("Couldn't find partition: %s", partition.data());