]>
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
50 url
= URI
.parse
"https://github.com/antirez/redis-doc/raw/master/commands.json"
51 client
= Net
::HTTP.new url
.host
, url
.port
53 response
= client
.get url
.path
54 if response
.is_a
?(Net
::HTTPSuccess)
55 @commands = JSON
.parse(response
.body
)
68 commands
.to_a
.sort
do |x
,y
|
70 end.map
do |key
, command
|
71 group
= GROUPS_BY_NAME
[command
["group"]]
73 STDERR.puts
"Please update groups array in #{__FILE__}"
74 raise "Unknown group #{command["group"]}"
79 "#{arguments(command)}",
80 "#{command["summary"]}",
82 "#{command["since"]}" }
90 /* Automatically generated by #{__FILE__}, do not edit. */
92 #ifndef __REDIS_HELP_H
93 #define __REDIS_HELP_H
95 static char *commandGroups[] = {