nix-super/src/libmain/common-args.hh

71 lines
1.6 KiB
C++
Raw Normal View History

#pragma once
///@file
#include "args.hh"
2023-04-28 17:57:37 +03:00
#include "repair-flag.hh"
namespace nix {
2021-01-25 20:03:13 +02:00
//static constexpr auto commonArgsCategory = "Miscellaneous common options";
static constexpr auto loggingCategory = "Logging-related options";
static constexpr auto miscCategory = "Miscellaneous global options";
2021-01-25 20:03:13 +02:00
class MixCommonArgs : public virtual Args
{
void initialFlagsProcessed() override;
public:
std::string programName;
MixCommonArgs(const std::string & programName);
protected:
virtual void pluginsInited() {}
};
struct MixDryRun : virtual Args
{
2017-04-24 15:21:36 +03:00
bool dryRun = false;
MixDryRun()
{
2021-01-25 20:03:13 +02:00
addFlag({
.longName = "dry-run",
.description = "Show what this command would do without doing it.",
//.category = commonArgsCategory,
.handler = {&dryRun, true},
});
}
};
2017-04-24 15:21:36 +03:00
struct MixJSON : virtual Args
{
bool json = false;
MixJSON()
{
2021-01-25 20:03:13 +02:00
addFlag({
.longName = "json",
.description = "Produce output in JSON format, suitable for consumption by another program.",
//.category = commonArgsCategory,
.handler = {&json, true},
});
2017-04-24 15:21:36 +03:00
}
};
2023-04-28 17:57:37 +03:00
struct MixRepair : virtual Args
{
RepairFlag repair = NoRepair;
MixRepair()
{
addFlag({
.longName = "repair",
.description =
"During evaluation, rewrite missing or corrupted files in the Nix store. "
"During building, rebuild missing or corrupted store paths.",
.category = miscCategory,
.handler = {&repair, Repair},
});
}
};
}