]>
git.saurik.com Git - redis.git/blob - utils/generate-command-help.rb
17 GROUPS_BY_NAME
= Hash
[*
18 GROUPS
.each_with_index
.map
do |n
,i
|
24 name
= arg
["name"].is_a
?(Array
) ? arg
["name"].join(" ") : arg
["name"]
25 name
= arg
["enum"].join
"|" if "enum" == arg
["type"]
26 name
= arg
["command"] +
" " + name
if arg
["command"]
28 name
= "#{name} [#{name} ...]"
37 return "-" unless command
["arguments"]
38 command
["arguments"].map
do |arg
|
44 return @commands if @commands
52 url
= URI
.parse
"https://raw.github.com/antirez/redis-doc/master/commands.json"
53 client
= Net
::HTTP.new url
.host
, url
.port
55 response
= client
.get url
.path
56 if response
.is_a
?(Net
::HTTPSuccess)
57 @commands = JSON
.parse(response
.body
)
70 commands
.to_a
.sort
do |x
,y
|
72 end.map
do |key
, command
|
73 group
= GROUPS_BY_NAME
[command
["group"]]
75 STDERR.puts
"Please update groups array in #{__FILE__}"
76 raise "Unknown group #{command["group"]}"
81 "#{arguments(command)}",
82 "#{command["summary"]}",
84 "#{command["since"]}" }
92 /* Automatically generated by #{__FILE__}, do not edit. */
94 #ifndef __REDIS_HELP_H
95 #define __REDIS_HELP_H
97 static char *commandGroups[] = {