aboutsummaryrefslogtreecommitdiff
path: root/src/nix/main.cc
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2022-01-04 17:39:16 +0100
committerEelco Dolstra <edolstra@gmail.com>2022-01-04 18:00:33 +0100
commit6d9a6d2cc3a20c9047436d174c9f91a2223da220 (patch)
tree2bf36cb443a80f56db38e10c8afe2c749ff3bdcc /src/nix/main.cc
parent1ffacad8a5201713659d5e18db47b2020bdc6aa1 (diff)
Ensure that attrsets are sorted
Previously you had to remember to call value->attrs->sort() after populating value->attrs. Now there is a BindingsBuilder helper that wraps Bindings and ensures that sort() is called before you can use it.
Diffstat (limited to 'src/nix/main.cc')
-rw-r--r--src/nix/main.cc9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/nix/main.cc b/src/nix/main.cc
index 759118fd5..fe7469be4 100644
--- a/src/nix/main.cc
+++ b/src/nix/main.cc
@@ -187,14 +187,11 @@ static void showHelp(std::vector<std::string> subcommand, MultiCommand & topleve
, "/"),
*vUtils);
- auto vArgs = state.allocValue();
- state.mkAttrs(*vArgs, 16);
- auto vJson = state.allocAttr(*vArgs, state.symbols.create("command"));
- mkString(*vJson, toplevel.toJSON().dump());
- vArgs->attrs->sort();
+ auto attrs = state.buildBindings(16);
+ attrs.alloc("command").mkString(toplevel.toJSON().dump());
auto vRes = state.allocValue();
- state.callFunction(*vGenerateManpage, *vArgs, *vRes, noPos);
+ state.callFunction(*vGenerateManpage, state.allocValue()->mkAttrs(attrs), *vRes, noPos);
auto attr = vRes->attrs->get(state.symbols.create(mdName + ".md"));
if (!attr)