From 7c0c2c0894796800da85514fc948b5662f1b7ab0 Mon Sep 17 00:00:00 2001 From: metamuffin Date: Fri, 9 Sep 2022 19:16:33 +0200 Subject: generate pref table --- client-web/scripts/gen_param_table.ts | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 client-web/scripts/gen_param_table.ts (limited to 'client-web/scripts/gen_param_table.ts') diff --git a/client-web/scripts/gen_param_table.ts b/client-web/scripts/gen_param_table.ts new file mode 100644 index 0000000..cc9a5ac --- /dev/null +++ b/client-web/scripts/gen_param_table.ts @@ -0,0 +1,21 @@ +import { PrefDecl, PREF_DECLS } from "../source/preferences.ts"; + +console.log(`Option name|Type|Default|Description`); +console.log(`---|---|---|---`); + +const P = PREF_DECLS as Record> +for (const key in P) { + const e = P[key]; + if (key == "username") e.default = "guest-…" // maybe generalize + const q = (e: string) => `\`${e}\`` + console.log([ + q(key), + typeof e.type, + e.default === undefined ? "-" : q(JSON.stringify(e.default)), + (e.description ?? "*none*") + ( + e.possible_values + ? " (" + e.possible_values.map(e => JSON.stringify(e)).map(q).join(" / ") + ")" + : "" + ) + ].join("|")); +} \ No newline at end of file -- cgit v1.2.3-70-g09d2