can refresh data via command line

This commit is contained in:
2026-01-05 14:42:54 -05:00
parent 59d50a694b
commit 3b3ebf8e31
2 changed files with 9 additions and 7 deletions

View File

@@ -20,12 +20,12 @@
:when (string-equal current opt)
:return next))
(defun refresh-data (data-type)
(defun refresh-data (data-type maybe-file-path)
(string-case data-type
("drops" (refresh (make-drop-data-source)))
("items" (refresh (make-item-data-source)))
("mobs" (refresh (make-mob-data-source)))
("spawns" (refresh (make-spawn-data-source)))))
("drops" (refresh (maybe-pass #'make-drop-data-source maybe-file-path)))
("items" (refresh (maybe-pass #'make-item-data-source maybe-file-path)))
("mobs" (refresh (maybe-pass #'make-mob-data-source maybe-file-path)))
("spawns" (refresh (maybe-pass #'make-spawn-data-source maybe-file-path)))))
(defun main ()
(sb-ext:disable-debugger)
@@ -34,7 +34,9 @@
(error "Simulated error!"))
(when (find-string "--version" args)
(print-version-information))
(when-let ((arg (get-arg "refresh"))))))
(when-let ((arg (get-arg "refresh" args)))
(let ((maybe-file-path (get-arg "--output" args)))
(refresh-data arg maybe-file-path)))))
(defun create-exe-and-die ()
(sb-ext:save-lisp-and-die

View File

@@ -36,7 +36,7 @@
(defun maybe-pass (func arg)
"Pass ARG to FUNC if arg is not nil."
(if (fnil)arg
(if (equal arg nil)
(funcall func arg)
(funcall func)))