mirror of
https://github.com/NixOS/nix
synced 2025-06-27 08:31:16 +02:00
Improve nix show-config --json
In particular, show descriptions. This could be used for manpage generation etc.
This commit is contained in:
parent
4410e9d995
commit
efa4bdbfcd
6 changed files with 71 additions and 43 deletions
|
@ -9,6 +9,8 @@ namespace nix {
|
|||
|
||||
class Args;
|
||||
class AbstractSetting;
|
||||
class JSONPlaceholder;
|
||||
class JSONObject;
|
||||
|
||||
/* A class to simplify providing configuration settings. The typical
|
||||
use is to inherit Config and add Setting<T> members:
|
||||
|
@ -56,6 +58,8 @@ public:
|
|||
void applyConfigFile(const Path & path, bool fatal = false);
|
||||
|
||||
void resetOverriden();
|
||||
|
||||
void toJSON(JSONObject & out);
|
||||
};
|
||||
|
||||
class AbstractSetting
|
||||
|
@ -90,6 +94,8 @@ protected:
|
|||
|
||||
virtual std::string to_string() = 0;
|
||||
|
||||
virtual void toJSON(JSONPlaceholder & out);
|
||||
|
||||
bool isOverriden() { return overriden; }
|
||||
};
|
||||
|
||||
|
@ -122,6 +128,8 @@ public:
|
|||
void set(const std::string & str) override;
|
||||
|
||||
std::string to_string() override;
|
||||
|
||||
void toJSON(JSONPlaceholder & out) override;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue