In TUI's confirm, the default value is used when pressing ENTER.
[mp-5.x.git] / tools / update_mp_configuration.mpsl
blob561b810bf523acd8e5231e5fd3b18fe489be5e36
1 sub repl(s,t) { local r = ''; while(t--) r = r ~ s; r; }
3 local header = [];
4 local desc = {};
5 local f;
7 if((f = open("doc/mp_configuration.txt", "r")) != NULL)
9         local l;
10         local k = '';
12         while(l = read(f))
13         {
14                 l = sregex("/\r?\n$/", l);
16                 if(l eq "----") break;
18                 if(regex('/^mp\.config\..+$/', l))
19                 {
20                         read(f); read(f);
21                         k = l;
22                         desc[k] = "";
23                 }
24                 else
25                 if(k)
26                         desc[k] = desc[k] ~ "\n" ~ l;
27                 else
28                         push(header, l);
29         }
31         close(f);
34 if((f = open("doc/mp_configuration.txt", "w")) != NULL)
36         write(f, join("\n", header) ~ "\n");
38         foreach(local k, map(sub(l) { 'mp.config.' ~ l; }, sort(keys(mp.config))))
39         {
40                 write(f, k ~ "\n");
41                 write(f, repl('-', size(k)));
42                 write(f, "\n");
44                 write(f, desc[k] || "To be written.\n");
45                 write(f, "\n");
46         }
48         write(f, "----\nAngel Ortega <angel@triptico.com>\n");
50         close(f);