Add redis-cli command

This commit is contained in:
Jeremy Dormitzer 2019-10-09 09:52:58 -04:00
parent c5d858182c
commit 7372e1affd

View File

@ -3148,3 +3148,24 @@ A fuzzy-finder for notes.
(async-shell-command "make"))
(error "Not in a project"))))
#+END_SRC
* Redis
#+BEGIN_SRC emacs-lisp
(defun redis-cli (&optional host port)
(interactive (list (read-string "host (default localhost): " nil nil "localhost")
(read-number "port: " 6379)))
(let ((cli-path (executable-find "redis-cli"))
(host (or host "localhost"))
(port (or port 6379)))
(if cli-path
(progn
(make-comint-in-buffer
"redis-cli"
nil
"redis-cli"
nil
"-h" host
"-p" (number-to-string port)
"--no-raw")
(switch-to-buffer "*redis-cli*"))
(error "Can't find redis-cli"))))
#+END_SRC