mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-22 08:08:53 -05:00
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:
parent
d616925835
commit
068190a802
566
src/help.h
566
src/help.h
File diff suppressed because it is too large
Load Diff
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user