2016-02-09 22:07:48 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "args.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";
|
|
|
|
|
2021-01-28 16:37:43 +02:00
|
|
|
class MixCommonArgs : public virtual Args
|
2016-02-09 22:07:48 +02:00
|
|
|
{
|
2021-01-28 16:37:43 +02:00
|
|
|
void initialFlagsProcessed() override;
|
|
|
|
public:
|
2016-02-09 22:28:29 +02:00
|
|
|
string programName;
|
2016-02-09 22:07:48 +02:00
|
|
|
MixCommonArgs(const string & programName);
|
2021-01-28 16:37:43 +02:00
|
|
|
protected:
|
|
|
|
virtual void pluginsInited() {}
|
2016-02-09 22:07:48 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
struct MixDryRun : virtual Args
|
|
|
|
{
|
2017-04-24 15:21:36 +03:00
|
|
|
bool dryRun = false;
|
2016-02-09 22:07:48 +02:00
|
|
|
|
|
|
|
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},
|
|
|
|
});
|
2016-02-09 22:07:48 +02:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
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
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2016-02-09 22:07:48 +02:00
|
|
|
}
|