Update generate-command-help.rb and help.h. (#10196)

There are some inevitable changes between the old and new output, as a
result of the different `commands.json` semantics.
This commit is contained in:
Yossi Gottlieb 2022-01-27 21:48:06 +02:00 committed by GitHub
parent d616925835
commit 068190a802
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 497 additions and 84 deletions

File diff suppressed because it is too large Load Diff

View File

@ -5,7 +5,7 @@ GROUPS = [
"string",
"list",
"set",
"sorted_set",
"sorted-set",
"hash",
"pubsub",
"transactions",
@ -27,17 +27,24 @@ GROUPS_BY_NAME = Hash[*
def argument arg
if "block" == arg["type"]
name = arg["block"].map do |entry|
name = arg["arguments"].map do |entry|
argument entry
end.join " "
elsif "oneof" == arg["type"]
name = arg["arguments"].map do |entry|
argument entry
end.join "|"
elsif "pure-token" == arg["type"]
name = nil # prepended later
else
name = arg["name"].is_a?(Array) ? arg["name"].join(" ") : arg["name"]
name = arg["enum"].join "|" if "enum" == arg["type"]
name = arg["command"] + (name ? " " + name : "") if arg["command"]
end
if arg["multiple"]
name = "#{name} [#{name} ...]"
end
if arg["token"]
name = [arg["token"], name].compact.join " "
end
if arg["optional"]
name = "[#{name}]"
end