Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix just executable argument positioning when setting custom flags #39

Merged
merged 3 commits into from
Sep 13, 2023
Merged
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
32 changes: 16 additions & 16 deletions justl.el
Original file line number Diff line number Diff line change
Expand Up @@ -351,18 +351,17 @@ Logs the command run."

(defun justl--parse (justfile)
"Extract info about JUSTFILE as parsed JSON."
(let ((json (justl--exec-to-string-with-exit-code
justl-executable
(justl--justfile-argument justfile)
"--unstable" "--dump" "--dump-format=json"))
(let* ((base-args (append `(,justl-executable)
(transient-args 'justl-help-popup)
`(,(justl--justfile-argument justfile))))
(json (apply 'justl--exec-to-string-with-exit-code
(delete-dups (append base-args '("--unstable" "--dump" "--dump-format=json")))))
;; Obtain the unsorted declaration order separately
(unsorted-recipes (s-split
" "
(s-trim-right
(justl--exec-to-string-with-exit-code
justl-executable
(justl--justfile-argument justfile)
"--summary" "--unsorted"))
(apply 'justl--exec-to-string-with-exit-code
(append base-args '("--summary" "--unsorted"))))
t)))
(let ((parsed (json-parse-string json :null-object nil :false-object nil :array-type 'list :object-type 'alist)))
(cl-flet ((unsorted-index (r)
Expand Down Expand Up @@ -478,14 +477,15 @@ not executed."
(eshell-buffer-name (format "justl - eshell - %s" (justl--recipe-name recipe)))
(default-directory (f-dirname justl-justfile)))
(eshell)
(insert (string-join
(cons
justl-executable
(cons (justl--recipe-name recipe)
(append (transient-args 'justl-help-popup)
(mapcar 'justl--arg-default
(justl--recipe-args recipe)))))
" "))

(let* ((recipe-name (justl--recipe-name recipe))
(recipe-args (justl--recipe-args recipe))
(transient-args (transient-args 'justl-help-popup))
(args-list (cons justl-executable
(append transient-args
(list recipe-name)
(mapcar 'justl--arg-default recipe-args)))))
(insert (string-join args-list " ")))
(unless no-send
(eshell-send-input))))

Expand Down