about summary refs log tree commit diff
path: root/src/libutil/config.hh
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2017-06-07T14·17+0200
committerEelco Dolstra <edolstra@gmail.com>2017-06-07T14·17+0200
commitb8283773bd64d7da6859ed520ee19867742a03ba (patch)
tree040443ef177a1a5ec1795fe9bd52d2b050d2fee8 /src/libutil/config.hh
parentc8cc50d46e78de7ae02c2cb7a5159e995c993f61 (diff)
nix: Make all options available as flags
Thus, instead of ‘--option <name> <value>’, you can write ‘--<name>
<value>’. So

  --option http-connections 100

becomes

  --http-connections 100

Apart from brevity, the difference is that it's not an error to set a
non-existent option via --option, but unrecognized arguments are
fatal.

Boolean options have special treatment: they're mapped to the
argument-less flags ‘--<name>’ and ‘--no-<name>’. E.g.

  --option auto-optimise-store false

becomes

  --no-auto-optimise-store
Diffstat (limited to 'src/libutil/config.hh')
-rw-r--r--src/libutil/config.hh6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/libutil/config.hh b/src/libutil/config.hh
index 77620d47d371..2ca643fe0e71 100644
--- a/src/libutil/config.hh
+++ b/src/libutil/config.hh
@@ -63,6 +63,8 @@ public:
     void resetOverriden();
 
     void toJSON(JSONObject & out);
+
+    void convertToArgs(Args & args);
 };
 
 class AbstractSetting
@@ -99,6 +101,8 @@ protected:
 
     virtual void toJSON(JSONPlaceholder & out);
 
+    virtual void convertToArg(Args & args);
+
     bool isOverriden() { return overriden; }
 };
 
@@ -132,6 +136,8 @@ public:
 
     std::string to_string() override;
 
+    void convertToArg(Args & args) override;
+
     void toJSON(JSONPlaceholder & out) override;
 };