aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/gen_protocol.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/scripts/gen_protocol.c b/scripts/gen_protocol.c
index b39bb7d..6746973 100644
--- a/scripts/gen_protocol.c
+++ b/scripts/gen_protocol.c
@@ -66,23 +66,24 @@ static void render_args(struct buf *b, yyjson_val *args)
buf_cell(b, jstr(a, "name"));
buf_puts(b, ":");
buf_cell(b, jstr(a, "type"));
- if (jbool(a, "required"))
- buf_puts(b, "!");
- yyjson_val *def = yyjson_obj_get(a, "default");
- if (def) {
- buf_puts(b, "=");
- buf_cell(b, yyjson_get_str(def));
- }
yyjson_val *vals = yyjson_obj_get(a, "values");
if (vals && yyjson_is_arr(vals)) {
size_t vi, vmax;
yyjson_val *v;
- buf_puts(b, " enum ");
+ buf_puts(b, "(");
yyjson_arr_foreach(vals, vi, vmax, v) {
if (vi)
buf_puts(b, "\\|");
buf_cell(b, yyjson_get_str(v));
}
+ buf_puts(b, ")");
+ }
+ if (jbool(a, "required"))
+ buf_puts(b, "!");
+ yyjson_val *def = yyjson_obj_get(a, "default");
+ if (def) {
+ buf_puts(b, "=");
+ buf_cell(b, yyjson_get_str(def));
}
buf_puts(b, "`");
}
@@ -103,7 +104,7 @@ static char *render_block(void)
buf_puts(&b, BEGIN_MARK "\n");
buf_puts(&b, "## Command catalogue (generated)\n\n");
buf_puts(&b, "Generated by `make gen-protocol` from the command tables; do not "
- "edit by hand.\nArgs: `name:type[!][=default][ enum a\\|b]`, `!` = "
+ "edit by hand.\nArgs: `name:type(values)[!][=default]`, `!` = "
"required.\n\n");
buf_puts(&b, "| Command | Permission | Org | Mutating | Dry run | Args |\n");
buf_puts(&b, "|---|---|---|---|---|---|\n");