Skip to content

Commit

Permalink
Merge pull request #268 from fukamachi/change-init-message-color
Browse files Browse the repository at this point in the history
Change the color of a message by 'qlot init'.
  • Loading branch information
fukamachi authored Aug 6, 2024
2 parents 04e331d + 3974bcf commit d319578
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
15 changes: 9 additions & 6 deletions src/cli.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -388,12 +388,15 @@ OPTIONS:
(uiop:quit -1)))

(ensure-package-loaded :qlot/init)
(let* ((qlfile (uiop:symbol-call '#:qlot/init '#:init-project *default-pathname-defaults*
:dist primary-dist))
(qlfile.lock (make-pathname :type "lock"
:defaults qlfile)))
(unless (uiop:file-exists-p qlfile.lock)
(warn-message "Run 'qlot install' to set up the project-local Quicklisp."))))))
(multiple-value-bind (qlfile created)
(uiop:symbol-call '#:qlot/init '#:init-project *default-pathname-defaults*
:dist primary-dist)
(let ((qlfile.lock (make-pathname :type "lock"
:defaults qlfile)))
(when created
(message (color-text :green "Successfully initialized!")))
(unless (uiop:file-exists-p qlfile.lock)
(message "Run 'qlot install' to set up the project-local Quicklisp.")))))))

(defun qlot-command-exec (argv)
(flet ((print-exec-usage ()
Expand Down
7 changes: 4 additions & 3 deletions src/init.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,10 @@
(error 'qlot-simple-error
:format-control "Directory does not exist: ~A"
:format-arguments (list object)))
(let ((qlfile (merge-pathnames *default-qlfile* object)))
(let* ((qlfile (merge-pathnames *default-qlfile* object))
(qlfile-exists (uiop:file-exists-p qlfile)))
;; Create 'qlfile'
(unless (uiop:file-exists-p qlfile)
(unless qlfile-exists
(message "Creating ~A" qlfile)
(with-open-file (out qlfile
:if-does-not-exist :create
Expand All @@ -61,4 +62,4 @@
:if-does-not-exist :create
:if-exists :append)
(format out "~&.qlot/~%"))))))
qlfile))))
(values qlfile (not qlfile-exists))))))

0 comments on commit d319578

Please sign in to comment.