update packages
This commit is contained in:
59
lisp/org-contrib/ob-redis.el
Normal file
59
lisp/org-contrib/ob-redis.el
Normal file
@@ -0,0 +1,59 @@
|
||||
;;; ob-redis.el --- Execute Redis queries within org-mode blocks
|
||||
;; Copyright 2016-2021 stardiviner
|
||||
|
||||
;; Author: stardiviner <numbchild@gmail.com>
|
||||
;; Maintainer: stardiviner <numbchild@gmail.com>
|
||||
;; Keywords: org babel redis
|
||||
;; Homepage: https://github.com/stardiviner/ob-redis
|
||||
;; Created: 28th Feb 2016
|
||||
;; Version: 0.0.1
|
||||
;; Package-Requires: ((org "8"))
|
||||
|
||||
;; This file is not part of GNU Emacs.
|
||||
;;
|
||||
;; GNU Emacs is free software: you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation, either version 3 of the License, or
|
||||
;; (at your option) any later version.
|
||||
;;
|
||||
;; GNU Emacs is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
;;
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; Execute Redis queries within org-mode blocks.
|
||||
|
||||
;;; Code:
|
||||
(require 'org)
|
||||
(require 'ob)
|
||||
|
||||
(defgroup ob-redis nil
|
||||
"org-mode blocks for Redis."
|
||||
:group 'org)
|
||||
|
||||
(defcustom ob-redis:default-db "127.0.0.1:6379"
|
||||
"Default Redis database."
|
||||
:group 'ob-redis
|
||||
:type 'string)
|
||||
|
||||
;;;###autoload
|
||||
(defun org-babel-execute:redis (body params)
|
||||
"org-babel redis hook."
|
||||
(let* ((db (or (cdr (assoc :db params))
|
||||
ob-redis:default-db))
|
||||
(cmd (mapconcat 'identity (list "redis-cli") " ")))
|
||||
(org-babel-eval cmd body)
|
||||
))
|
||||
|
||||
;;;###autoload
|
||||
(eval-after-load 'org
|
||||
'(add-to-list 'org-src-lang-modes '("redis" . redis)))
|
||||
|
||||
(provide 'ob-redis)
|
||||
|
||||
;;; ob-redis.el ends here
|
||||
Reference in New Issue
Block a user