Skip to content

Instantly share code, notes, and snippets.

@cmason
Created March 31, 2017 19:53
Show Gist options
  • Save cmason/48ced23c90cf4325e4bf05f32e6b34fd to your computer and use it in GitHub Desktop.
Save cmason/48ced23c90cf4325e4bf05f32e6b34fd to your computer and use it in GitHub Desktop.
Use redis-cli with a URI
#!/usr/bin/env ruby
require 'uri'
if ARGV.empty?
puts "Usage: redis-cli-uri <uri> [REDIS-CLI OPTIONS] [cmd [arg [arg ...]]]"
exit 1
end
uri = URI.parse(ARGV.shift)
system(%Q(redis-cli -h "#{uri.host}" -p "#{uri.port}" -a "#{uri.password}" #{ARGV.join(' ')}))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment