Skip to content

Commit

Permalink
Merge pull request #61 from psibi/private-all
Browse files Browse the repository at this point in the history
Handle private recipes for interactive prompts too
  • Loading branch information
psibi authored Nov 15, 2024
2 parents d5ff9ab + 9b33ebf commit 649490d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions justl.el
Original file line number Diff line number Diff line change
Expand Up @@ -434,10 +434,13 @@ Logs the command run."
"Return all the recipes from JUSTFILE.
They are returned as objects, as per the JSON output of \"just --dump\"."
(let-alist (justl--parse justfile)
(mapcar (lambda (x) (make-recipe :name (alist-get 'name x)
(let ((all-recipes (mapcar (lambda (x) (make-recipe :name (alist-get 'name x)
:doc (alist-get 'doc x)
:parameters (alist-get 'parameters x)
:private (alist-get 'private x))) .recipes)))
(if justl-include-private-recipes
all-recipes
(seq-filter (lambda (recipe) (not (justl--recipe-private-p recipe))) all-recipes)))))

;;; todo: For easily integrating it, we need something like this
;;; integrated upstream:
Expand Down Expand Up @@ -530,10 +533,7 @@ They are returned as objects, as per the JSON output of \"just --dump\"."
(justl--recipe-name r)
(vector (propertize (justl--recipe-name r) 'recipe r)
(or (justl--recipe-desc r) ""))))
(seq-filter (lambda (r)
(or justl-include-private-recipes
(not (justl--recipe-private-p r))))
recipes)))
recipes))

(defun justl-exec-eshell (&optional no-send)
"Execute just recipe in eshell.
Expand Down
2 changes: 1 addition & 1 deletion test/justl-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

(ert-deftest justl--get-recipes-test ()
(should (equal
(list "default" "build-cmd" "plan" "push" "push2" "fail" "carriage-return" "color" "_private")
(list "default" "build-cmd" "plan" "push" "push2" "fail" "carriage-return" "color")
(mapcar 'justl--recipe-name (justl--get-recipes "./justfile")))))

(ert-deftest justl--get-description-test ()
Expand Down

0 comments on commit 649490d

Please sign in to comment.