Skip to content

Instantly share code, notes, and snippets.

@aj0strow
Created October 12, 2014 00:12
Show Gist options
  • Save aj0strow/2bc25ff4c6a15404ad55 to your computer and use it in GitHub Desktop.
Save aj0strow/2bc25ff4c6a15404ad55 to your computer and use it in GitHub Desktop.
Redis Commands
#!/usr/bin/env ruby
require 'nokogiri'
require 'open-uri'
if ARGV.length > 1
puts 'redis-commands [group]'
exit 1
end
group = ARGV.first
html = Nokogiri::HTML(open('http://redis.io/commands'))
selector = '.command a text()'
unless group.nil?
selector.prepend('li[data-group="%s"] ' % group)
end
commands = html.css(selector)
puts commands
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment