-
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: Add docs command * changelog * fix doc
- Loading branch information
Showing
11 changed files
with
166 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/** | ||
* Copyright (C) 2024 the Eask authors. | ||
* | ||
* This program 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, or (at your option) | ||
* any later version. | ||
* | ||
* This program 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 this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
"use strict"; | ||
|
||
exports.command = ['docs [names..]', 'doc [names..]']; | ||
exports.desc = 'Build documentation'; | ||
exports.builder = yargs => yargs | ||
.positional( | ||
'[names..]', { | ||
description: 'specify source files to scan', | ||
type: 'array', | ||
}) | ||
.options({ | ||
'destination': { | ||
description: 'optional output destination', | ||
requiresArg: true, | ||
alias: 'dest', | ||
type: 'string', | ||
group: TITLE_CMD_OPTION, | ||
}, | ||
}); | ||
|
||
exports.handler = async (argv) => { | ||
await UTIL.e_call(argv, 'core/docs' | ||
, argv.names | ||
, UTIL.def_flag(argv.dest, '--dest', argv.dest)); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
;;; core/docs.el --- Build documentation -*- lexical-binding: t; -*- | ||
|
||
;;; Commentary: | ||
;; | ||
;; Build documentation for your Elisp project, | ||
;; | ||
;; $ eask docs [names..] | ||
;; | ||
;; | ||
;; Positionals: | ||
;; | ||
;; [names..] specify files to scan | ||
;; | ||
;; Action options: | ||
;; | ||
;; [destination] optional output destination | ||
;; | ||
|
||
;;; Code: | ||
|
||
(let ((dir (file-name-directory (nth 1 (member "-scriptload" command-line-args))))) | ||
(load (expand-file-name "_prepare.el" | ||
(locate-dominating-file dir "_prepare.el")) | ||
nil t)) | ||
|
||
;; | ||
;;; Externals | ||
|
||
(require 'el2org nil t) | ||
|
||
;; | ||
;;; Core | ||
|
||
(defun eask-docs--to-html (el-file) | ||
"Generate html file from EL-FILE." | ||
(interactive) | ||
(let* ((filename (file-name-nondirectory el-file)) | ||
(html-file (expand-file-name (concat (file-name-sans-extension filename) | ||
".html") | ||
eask-docs-path))) | ||
(eask-with-verbosity 'debug | ||
(el2org-generate-file el-file nil 'html html-file t)))) | ||
|
||
(eask-start | ||
;; Preparation | ||
(eask-with-archives '("gnu" "melpa") | ||
(eask-package-install 'el2org)) | ||
|
||
;; Start building... | ||
(require 'el2org) | ||
(let* ((patterns (eask-args)) | ||
(files (if patterns (eask-expand-file-specs patterns) | ||
(eask-package-el-files))) | ||
(eask-docs-path (or (eask-dest) eask-docs-path))) | ||
(cond | ||
;; Files found, do the action! | ||
(files | ||
(eask-debug "Destination path in %s" eask-docs-path) | ||
(ignore-errors (make-directory eask-docs-path t)) | ||
|
||
(eask-progress-seq | ||
" - Processing" files "done! ✓" #'eask-docs--to-html) | ||
(eask-msg "") | ||
(eask-info "Done. (Converted %s file%s)" (length files) | ||
(eask--sinr files "" "s"))) | ||
;; Pattern defined, but no file found! | ||
(patterns | ||
(eask-info "(No files match wildcard: %s)" | ||
(mapconcat #'identity patterns " "))) | ||
;; Default, print help! | ||
(t | ||
(eask-info "(No elisp source can be read)") | ||
(eask-help "core/docs"))))) | ||
|
||
;;; core/docs.el ends here |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
💡 You would need to specify the [names..] in order to make concatenation! | ||
|
||
$ eask concat [names..] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
💡 You would need to specify the [names..] in order to build documentation! | ||
|
||
$ eask docs [names..] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters