]>
git.saurik.com Git - redis.git/blob - utils/generate-command-help.rb
16 GROUPS_BY_NAME
= Hash
[*
17 GROUPS
.each_with_index
.map
do |n
,i
|
23 name
= arg
["name"].is_a
?(Array
) ? arg
["name"].join(" ") : arg
["name"]
24 name
= arg
["enum"].join
"|" if "enum" == arg
["type"]
25 name
= arg
["command"] +
" " + name
if arg
["command"]
27 name
= "#{name} [#{name} ...]"
36 return "-" unless command
["arguments"]
37 command
["arguments"].map
do |arg
|
43 return @commands if @commands
51 url
= URI
.parse
"https://github.com/antirez/redis-doc/raw/master/commands.json"
52 client
= Net
::HTTP.new url
.host
, url
.port
54 response
= client
.get url
.path
55 if response
.is_a
?(Net
::HTTPSuccess)
56 @commands = JSON
.parse(response
.body
)
69 commands
.to_a
.sort
do |x
,y
|
71 end.map
do |key
, command
|
72 group
= GROUPS_BY_NAME
[command
["group"]]
74 STDERR.puts
"Please update groups array in #{__FILE__}"
75 raise "Unknown group #{command["group"]}"
80 "#{arguments(command)}",
81 "#{command["summary"]}",
83 "#{command["since"]}" }
91 /* Automatically generated by #{__FILE__}, do not edit. */
93 #ifndef __REDIS_HELP_H
94 #define __REDIS_HELP_H
96 static char *commandGroups[] = {