Skip to content

Commit

Permalink
Fix default argument handling
Browse files Browse the repository at this point in the history
  • Loading branch information
purcell committed Aug 18, 2023
1 parent a44f20d commit 9916456
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions justl.el
Original file line number Diff line number Diff line change
Expand Up @@ -388,11 +388,6 @@ They are returned as objects, as per the JSON output of \"just --dump\"."
"Get the default value of argument ARG."
(let-alist arg .default))

(defun justl--arg-default-as-string (arg)
"Get the default value of argument ARG as a string.
Empty string is returned if the arg has no default."
(if arg (format "%s" arg) ""))

(defun justl--justfile-argument ()
"Provides justfile argument with the proper location."
(format "--justfile=%s" (tramp-file-local-name justl-justfile)))
Expand All @@ -418,7 +413,7 @@ Empty string is returned if the arg has no default."
(cons recipe-name
(mapcar (lambda (arg) (read-from-minibuffer
(format "Just arg for %s: " (justl--arg-name arg))
(justl--arg-default-as-string arg)))
(justl--arg-default arg)))
(justl--recipe-args recipe)))))))

(defun justl-exec-default-recipe ()
Expand Down Expand Up @@ -469,7 +464,7 @@ not executed."
justl-executable
(cons (justl--recipe-name recipe)
(append (transient-args 'justl-help-popup)
(mapcar 'justl--arg-default-as-string
(mapcar 'justl--arg-default
(justl--recipe-args recipe)))))
" "))
(unless no-send
Expand Down Expand Up @@ -522,7 +517,7 @@ not executed."
(cons (justl--recipe-name recipe)
(mapcar (lambda (arg) (read-from-minibuffer
(format "Just arg for `%s': " (justl--arg-name arg))
(justl--arg-default-as-string arg)))
(justl--arg-default arg)))
(justl--recipe-args recipe)))))))

(defun justl--exec-recipe-with-args ()
Expand Down

0 comments on commit 9916456

Please sign in to comment.