Skip to content

Commit

Permalink
Add yes option
Browse files Browse the repository at this point in the history
  • Loading branch information
jcs090218 committed Oct 1, 2023
1 parent bab6351 commit 4334c0e
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 7 deletions.
14 changes: 12 additions & 2 deletions cmds/generate/recipe.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,18 @@ exports.builder = yargs => yargs
description: 'destination path/folder',
alias: 'dest',
type: 'string',
});
})
.options({
'yes': {
description: 'assume the answer to all prompts is yes',
alias: 'y',
type: 'boolean',
group: TITLE_CMD_OPTION,
},
});

exports.handler = async (argv) => {
await UTIL.e_call(argv, 'generate/recipe', argv.dest);
await UTIL.e_call(argv, 'generate/recipe'
, argv.dest
, UTIL.def_flag(argv.yes, '--yes'));
};
4 changes: 4 additions & 0 deletions lisp/_prepare.el
Original file line number Diff line number Diff line change
Expand Up @@ -688,6 +688,9 @@ full detials."
(defun eask-strict-p ()
"Non-nil when flag is on (`--strict')."
(eask--flag "--strict"))
(defun eask-yes-p ()
"Non-nil when flag is on (`--yes')."
(eask--flag "--yes"))
(defun eask-timestamps-p ()
"Non-nil when flag is on (`--timestamps')."
(eask--flag "--timestamps"))
Expand Down Expand Up @@ -798,6 +801,7 @@ other scripts internally. See function `eask-call'.")
(eask--form-options
'("-g" "-c" "-a" "-q" "-f" "--dev"
"--debug" "--strict"
"--yes"
"--allow-error"
"--insecure"
"--timestamps" "--log-level"
Expand Down
3 changes: 1 addition & 2 deletions lisp/core/recipe.el
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@
(eask-msg "")
(eask-msg "recipes/%s:" name)
(eask-msg "")
(eask-msg "%s" (pp-to-string recipe))
(eask-msg ""))
(eask-msg "%s" (pp-to-string recipe)))
(eask-msg "")
(eask-info "(Repository URL is required to form a recipe)")
(eask-help "core/recipe")))
Expand Down
5 changes: 3 additions & 2 deletions lisp/generate/recipe.el
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,15 @@
(eask-recipe-path (expand-file-name eask-recipe-path))
(recipe-file (expand-file-name name eask-recipe-path))
(recipe-string (pp-to-string recipe)))
(when (yes-or-no-p (format "%s\nIs this OK? " recipe-string))
(when (or (eask-yes-p)
(yes-or-no-p (format "%s\nIs this OK? " recipe-string)))
(ignore-errors (make-directory eask-recipe-path t))
(with-current-buffer (find-file recipe-file)
(erase-buffer)
(insert recipe-string)
(save-buffer))
(eask-msg "")
(eask-info "(Generated in %s)" recipe-file)))
(eask-msg "")
(eask-info "(Repository URL is required to form a recipe)")
(eask-help "core/recipe")))

Expand Down
2 changes: 1 addition & 1 deletion test/commands/local/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ eask eval "(progn (require 'mini.emacs.pkg.1))"
# Generation
eask generate autoloads
eask generate pkg-file
eask generate recipe
eask generate recipe -y
#eask generate license gpl-3.0 # XXX: Avoid API rate limit exceeded error
eask generate ignore elisp

Expand Down

0 comments on commit 4334c0e

Please sign in to comment.