justl.el
justl.el copied to clipboard
Handing private commands
Hi there,
I have a justfile that looks like this:
# Usage info
_default:
just --list
# Build & switch to new configuration
switch:
just _rebuild switch \
--show-trace \
--fallback \
--refresh \
--flake '.#'
[macos]
update:
nix-channel --update darwin
darwin-rebuild changelog
[linux]
update:
sudo nix-channel --update
sudo nixos-rebuild changelog
[linux]
_rebuild *args:
sudo nixos-rebuild {{args}}
[macos]
_rebuild *args:
darwin-rebuild {{args}}
By default, justl shows this:
But _default and _rebuild are private tasks - if I run just --list, I see:
johnhamelink@jh-mbp nix % just --list
Available recipes:
switch # Build & switch to new configuration
update
I think this should be the default behaviour.
I was able to fix this by adding seq-remove to justl--parse like so:
diff --git a/justl.el b/justl.el
index 071adb7..fa07ba9 100644
--- a/justl.el
+++ b/justl.el
@@ -371,8 +371,9 @@ Logs the command run."
1000))))
(let ((recipes-entry (assoc 'recipes parsed)))
(setcdr recipes-entry
- (seq-sort (lambda (a b) (< (unsorted-index a) (unsorted-index b)))
- (cdr recipes-entry)))
+ (seq-remove (lambda (r) (equal (alist-get 'private r) t))
+ (seq-sort (lambda (a b) (< (unsorted-index a) (unsorted-index b)))
+ (cdr recipes-entry))))
parsed)))))
(defun justl--get-recipes (justfile)
What do you think? We could use let* and instead optionally filter the list before sorting it against the index, so that previous behaviour could be preserved by enabling a feature-flag?
~~(Btw Sorry, I haven't had the chance to catch up on #39, I'll try to get to that this week!)~~ fixed!
I think this should be the default behaviour.
Yes, I agree.
What do you think? We could use let* and instead optionally filter the list before sorting it against the index, so that previous behaviour could be preserved by enabling a feature-flag?
Sounds good to me.
Ok, I might have time to contribute a PR this evening :)
justl-include-private-recipes does not work, is it supposed to handle this?
The latest change handles this, thanks for the report!