Adds support for nested args in cli's help (#8074)
See https://github.com/redis/redis-doc/pull/1443 Also allows nameless commands.
This commit is contained in:
parent
ada2ac9ae2
commit
d322e7baba
@ -25,9 +25,15 @@ GROUPS_BY_NAME = Hash[*
|
||||
].freeze
|
||||
|
||||
def argument arg
|
||||
name = arg["name"].is_a?(Array) ? arg["name"].join(" ") : arg["name"]
|
||||
name = arg["enum"].join "|" if "enum" == arg["type"]
|
||||
name = arg["command"] + " " + name if arg["command"]
|
||||
if "block" == arg["type"]
|
||||
name = arg["block"].map do |entry|
|
||||
argument entry
|
||||
end.join " "
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user