From f7b507587d2b612de61e29109ce16e26c3ca9f25 Mon Sep 17 00:00:00 2001 From: Daniel Barlow Date: Wed, 9 Aug 2023 22:26:50 +0100 Subject: [PATCH] print modules in consistent (alphabetical) order --- doc/parse-options.fnl | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/doc/parse-options.fnl b/doc/parse-options.fnl index 063bb2b4..ca1747ab 100644 --- a/doc/parse-options.fnl +++ b/doc/parse-options.fnl @@ -72,13 +72,17 @@ (let [e (or (. modules path) [])] (table.insert e option) (tset modules path e)))) - (each [name module (pairs modules)] - (print (or (read-preamble name) (headline name))) - (let [options (sort-options module)] - (each [_ o (ipairs options)] - (if (= o.type "parametrisable s6-rc service definition") - (print-service o) - (print-option o)))))) + (tset modules "lib/modules.nix" nil) + (let [module-names (doto (icollect [n _ (pairs modules)] n) table.sort)] + (io.stderr:write (view module-names)) + (each [_ name (ipairs module-names)] + (let [module (. modules name) + options (sort-options module)] + (print (or (read-preamble name) (headline name))) + (each [_ o (ipairs options)] + (if (= o.type "parametrisable s6-rc service definition") + (print-service o) + (print-option o))))))) ;; for each element el, add to table modules keyed on ;; el.declarations