|
| 1 | +;;; ob-phpstan.el --- run phpstan with org-babel -*-lexical-binding:t -*- |
| 2 | + |
| 3 | +;; Author: Takeo Obara <bararararatty@gmail.com> |
| 4 | +;; Maintainer: Takeo Obara |
| 5 | +;; Version: v1.0.0 |
| 6 | +;; Package-Requires: ((emacs "29.0")) |
| 7 | +;; Homepage: https://github.com/takeokunn/ob-phpstan |
| 8 | +;; Keywords: phpstan, org, babel |
| 9 | + |
| 10 | +;; This file is not part of GNU Emacs |
| 11 | + |
| 12 | +;; This file is free software; you can redistribute it and/or modify |
| 13 | +;; it under the terms of the GNU General Public License as published by |
| 14 | +;; the Free Software Foundation; either version 3, or (at your option) |
| 15 | +;; any later version. |
| 16 | + |
| 17 | +;; This program is distributed in the hope that it will be useful, |
| 18 | +;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 19 | +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 20 | +;; GNU General Public License for more details. |
| 21 | + |
| 22 | +;; For a full copy of the GNU General Public License |
| 23 | +;; see <http://www.gnu.org/licenses/>. |
| 24 | + |
| 25 | + |
| 26 | +;;; Commentary: |
| 27 | + |
| 28 | +;; run phpstan with org-babel |
| 29 | + |
| 30 | +;;; Code: |
| 31 | +(require'org) |
| 32 | +(require'ob) |
| 33 | + |
| 34 | +(defgroupob-phpstannil |
| 35 | +"org-mode blocks for fish script" |
| 36 | +:group'org) |
| 37 | + |
| 38 | +(defcustomorg-babel-phpstan-command"~/.asdf/installs/php/8.2.3/.composer/vendor/bin/phpstan" |
| 39 | +"The command to execute babel body code." |
| 40 | +:group'ob-phpstan |
| 41 | +:type'string) |
| 42 | + |
| 43 | +(defcustomorg-babel-phpstan-command-optionsnil |
| 44 | +"The fish command options to use when execute code." |
| 45 | +:group'ob-phpstan |
| 46 | +:type'list) |
| 47 | + |
| 48 | +;;;###autoload |
| 49 | +(defunorg-babel-execute:phpstan (body_) |
| 50 | +"Org mode fish evaluate function" |
| 51 | + (let ((cmd (concat org-babel-phpstan-command"" (mapconcat'string org-babel-phpstan-command-options"")))) |
| 52 | + (org-babel-eval cmd body))) |
| 53 | + |
| 54 | +(provide'ob-phpstan) |
| 55 | + |
| 56 | +;;; ob-phpstan.el ends here |