doomemacs/lisp/cli/make.el
Henrik Lissner b9933e6637
refactor!: restructure Doom core
BREAKING CHANGE: This restructures the project in preparation for Doom
to be split into two repos. Users that have reconfigured Doom's CLI
stand a good chance of seeing breakage, especially if they've referred
to any core-* feature, e.g.

  (after! core-cli-ci ...)

To fix it, simply s/core-/doom-/, i.e.

  (after! doom-cli-ci ...)

What this commit specifically changes is:
- Renames all core features from core-* to doom-*
- Moves core/core-* -> lisp/doom-*
- Moves core/autoloads/* -> lisp/lib/*
- Moves core/templates -> templates/

Ref: #4273
2022-07-30 22:41:13 +02:00

64 lines
1.7 KiB
EmacsLisp

;;; lisp/cli/make.el --- file generation commands -*- lexical-binding: t; -*-
;;; Commentary:
;;; Code:
(load! "make/completions")
;; (load! "make/docs")
;; (load! "make/manpage")
;;
;;; Variables
;; (defvar doom-make-codeowners ()
;; "TODO")
;;
;;; Commands
(defcli! make ()
"(Re)Generate project files and boilerplate."
:partial t)
;; TODO Finish and generalize me
(defstub! (make codeowners) ()
"TODO"
(print! (start "Generating CODEOWNERS file"))
(let ((codeowners (doom-path doom-emacs-dir ".github/CODEOWNERS")))
(with-temp-file codeowners
(insert-file-contents codeowners)
(when (re-search-forward "^# Don't edit this by hand!" nil t)
(goto-char (line-end-position))
(delete-region (point) (point-max))
(insert "\n")
(dolist (path (cdr (doom-module-load-path (list doom-modules-dir))))
(when (string-match "/modules/\\([^/]+\\)/\\([^/]+\\)/$" path)
(insert (format "%-35s @doomemacs/maintainers @doomemacs/%s-%s\n"
(concat (substring (match-string-no-properties 0 path) 1) "*")
(match-string-no-properties 1 path)
(match-string-no-properties 2 path)))))))))
;; TODO Finish me
(defstub! (make changelog))
;;
;;; Helpers
(defmacro doom-make--with-file (file &rest body)
(declare (indent 1))
`(let ((inhibit-read-only t))
(with-current-buffer
(or (get-file-buffer ,file)
(find-file-noselect ,file))
(save-excursion
(goto-char (point-min))
,@body
(when (buffer-modified-p)
(save-buffer))))))
(provide 'doom-cli-make)
;;; make.el ends here