aboutsummaryrefslogtreecommitdiff
path: root/src/libmain/common-args.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/libmain/common-args.hh')
-rw-r--r--src/libmain/common-args.hh23
1 files changed, 20 insertions, 3 deletions
diff --git a/src/libmain/common-args.hh b/src/libmain/common-args.hh
index a4de3dccf..31bdf527a 100644
--- a/src/libmain/common-args.hh
+++ b/src/libmain/common-args.hh
@@ -4,10 +4,17 @@
namespace nix {
-struct MixCommonArgs : virtual Args
+//static constexpr auto commonArgsCategory = "Miscellaneous common options";
+static constexpr auto loggingCategory = "Logging-related options";
+
+class MixCommonArgs : public virtual Args
{
+ void initialFlagsProcessed() override;
+public:
string programName;
MixCommonArgs(const string & programName);
+protected:
+ virtual void pluginsInited() {}
};
struct MixDryRun : virtual Args
@@ -16,7 +23,12 @@ struct MixDryRun : virtual Args
MixDryRun()
{
- mkFlag(0, "dry-run", "show what this command would do without doing it", &dryRun);
+ addFlag({
+ .longName = "dry-run",
+ .description = "Show what this command would do without doing it.",
+ //.category = commonArgsCategory,
+ .handler = {&dryRun, true},
+ });
}
};
@@ -26,7 +38,12 @@ struct MixJSON : virtual Args
MixJSON()
{
- mkFlag(0, "json", "produce JSON output", &json);
+ addFlag({
+ .longName = "json",
+ .description = "Produce output in JSON format, suitable for consumption by another program.",
+ //.category = commonArgsCategory,
+ .handler = {&json, true},
+ });
}
};