2016-02-09 20:07:48 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "args.hh"
|
|
|
|
|
|
|
|
namespace nix {
|
|
|
|
|
2021-01-25 18:03:13 +00:00
|
|
|
//static constexpr auto commonArgsCategory = "Miscellaneous common options";
|
|
|
|
static constexpr auto loggingCategory = "Logging-related options";
|
2022-10-12 13:09:00 +00:00
|
|
|
static constexpr auto miscCategory = "Miscellaneous global options";
|
2021-01-25 18:03:13 +00:00
|
|
|
|
2021-01-28 14:37:43 +00:00
|
|
|
class MixCommonArgs : public virtual Args
|
2016-02-09 20:07:48 +00:00
|
|
|
{
|
2021-01-28 14:37:43 +00:00
|
|
|
void initialFlagsProcessed() override;
|
|
|
|
public:
|
2022-02-25 15:00:00 +00:00
|
|
|
std::string programName;
|
|
|
|
MixCommonArgs(const std::string & programName);
|
2021-01-28 14:37:43 +00:00
|
|
|
protected:
|
|
|
|
virtual void pluginsInited() {}
|
2016-02-09 20:07:48 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct MixDryRun : virtual Args
|
|
|
|
{
|
2017-04-24 12:21:36 +00:00
|
|
|
bool dryRun = false;
|
2016-02-09 20:07:48 +00:00
|
|
|
|
|
|
|
MixDryRun()
|
|
|
|
{
|
2021-01-25 18:03:13 +00:00
|
|
|
addFlag({
|
|
|
|
.longName = "dry-run",
|
|
|
|
.description = "Show what this command would do without doing it.",
|
|
|
|
//.category = commonArgsCategory,
|
|
|
|
.handler = {&dryRun, true},
|
|
|
|
});
|
2016-02-09 20:07:48 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2017-04-24 12:21:36 +00:00
|
|
|
struct MixJSON : virtual Args
|
|
|
|
{
|
|
|
|
bool json = false;
|
|
|
|
|
|
|
|
MixJSON()
|
|
|
|
{
|
2021-01-25 18:03:13 +00:00
|
|
|
addFlag({
|
|
|
|
.longName = "json",
|
|
|
|
.description = "Produce output in JSON format, suitable for consumption by another program.",
|
|
|
|
//.category = commonArgsCategory,
|
|
|
|
.handler = {&json, true},
|
|
|
|
});
|
2017-04-24 12:21:36 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2016-02-09 20:07:48 +00:00
|
|
|
}
|