Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how
* Add command to clean log files (#97)
* Add command to clean autoloads file (#98)
* Add command to clean pkg-file (#99)
* feat: Add option `-o`/`--output` to output log for Eask checker (#100)

## 0.7.x
> Released Sep 08, 2022
Expand Down
5 changes: 5 additions & 0 deletions cmds/checker/check-eask.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ exports.builder = {
requiresArg: false,
type: 'array',
},
output: {
description: 'Output result to a file',
alias: 'o',
type: 'string',
},
json: {
description: 'Output lint result in JSON format',
type: 'boolean',
Expand Down
10 changes: 6 additions & 4 deletions lisp/_prepare.el
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,7 @@ the `eask-start' execution.")
(defun eask-json-p () (eask--flag "--json")) ; --json

;;; String (with arguments)
(defun eask-output () (eask--flag-value "-o")) ; --o, --output
(defun eask-proxy () (eask--flag-value "--proxy")) ; --proxy
(defun eask-http-proxy () (eask--flag-value "--http-proxy")) ; --http-proxy
(defun eask-https-proxy () (eask--flag-value "--https-proxy")) ; --https-proxy
Expand Down Expand Up @@ -504,15 +505,16 @@ other scripts internally. See function `eask-call'.")
"--timestamps" "--log-level"
"--log-file"
"--elapsed-time"
"--no-color"))
"--no-color"
"--json"))
"List of boolean type options.")

(defconst eask--option-args
(eask--form-options
'("--proxy" "--http-proxy" "--https-proxy" "--no-proxy"
'("-o"
"--proxy" "--http-proxy" "--https-proxy" "--no-proxy"
"--verbose" "--silent"
"--depth" "--dest"
"--json"))
"--depth" "--dest"))
"List of arguments (number/string) type options.")

(defconst eask--command-list
Expand Down
23 changes: 17 additions & 6 deletions lisp/checker/check-eask.el
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@
default-directory))
(files (or (eask-expand-file-specs (eask-args))
(eask-expand-file-specs '("Eask*" "**/Eask*"))))
checked-files)
checked-files
content)
;; Linting
(dolist (file files)
(eask--save-eask-file-state
Expand All @@ -128,15 +129,25 @@
(eask-msg "")
(cond ((and (eask-json-p) ; JSON format
(or eask--checker-warnings eask--checker-errors))
(eask-msg
(eask--pretty-json (json-encode
`((warnings . ,eask--checker-warnings)
(errors . ,eask--checker-errors))))))
(setq content
(eask--pretty-json (json-encode
`((warnings . ,eask--checker-warnings)
(errors . ,eask--checker-errors)))))
(eask-msg content))
(eask--checker-log ; Plain text
(setq content
(with-temp-buffer
(dolist (msg (reverse eask--checker-log))
(insert msg "\n"))
(buffer-string)))
(mapc #'eask-msg (reverse eask--checker-log)))
(t
(eask-info "(Checked %s file%s)"
(length checked-files)
(eask--sinr checked-files "" "s")))))
(eask--sinr checked-files "" "s"))))

;; Output file
(when (and content (eask-output))
(write-region content nil (eask-output))))

;;; checker/check-eask.el ends here
1 change: 1 addition & 0 deletions src/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ function _global_options(argv) {
/* Number type */
flags.push(def_flag(argv.verbose, '--verbose', argv.verbose));
/* String type */
flags.push(def_flag(argv.output, '-o', argv.output));
flags.push(def_flag(argv.proxy, '--proxy', argv.proxy));
flags.push(def_flag(argv['http-proxy'], '--http-proxy', argv['http-proxy']));
flags.push(def_flag(argv['https-proxy'], '--https-proxy', argv['https-proxy']));
Expand Down