Nix 2.26.3
Nix, the purely functional package manager; unstable internal interfaces
 
Loading...
Searching...
No Matches
common-args.hh
Go to the documentation of this file.
1#pragma once
3
4#include "args.hh"
5#include "repair-flag.hh"
6
7namespace nix {
8
9//static constexpr auto commonArgsCategory = "Miscellaneous common options";
10static constexpr auto loggingCategory = "Logging-related options";
11static constexpr auto miscCategory = "Miscellaneous global options";
12
13class MixCommonArgs : public virtual Args
14{
15 void initialFlagsProcessed() override;
16public:
17 std::string programName;
18 MixCommonArgs(const std::string & programName);
19protected:
20 virtual void pluginsInited() {}
21};
22
23struct MixDryRun : virtual Args
24{
25 bool dryRun = false;
26
27 MixDryRun()
28 {
29 addFlag({
30 .longName = "dry-run",
31 .description = "Show what this command would do without doing it.",
32 //.category = commonArgsCategory,
33 .handler = {&dryRun, true},
34 });
35 }
36};
37
38struct MixJSON : virtual Args
39{
40 bool json = false;
41
42 MixJSON()
43 {
44 addFlag({
45 .longName = "json",
46 .description = "Produce output in JSON format, suitable for consumption by another program.",
47 //.category = commonArgsCategory,
48 .handler = {&json, true},
49 });
50 }
51};
52
53struct MixRepair : virtual Args
54{
55 RepairFlag repair = NoRepair;
56
57 MixRepair()
58 {
59 addFlag({
60 .longName = "repair",
61 .description =
62 "During evaluation, rewrite missing or corrupted files in the Nix store. "
63 "During building, rebuild missing or corrupted store paths.",
64 .category = miscCategory,
65 .handler = {&repair, Repair},
66 });
67 }
68};
69
70}
Definition args.hh:28