diff --git a/src/command-line.lisp b/src/command-line.lisp index 94ec57e..cb12eb4 100644 --- a/src/command-line.lisp +++ b/src/command-line.lisp @@ -22,53 +22,59 @@ (defmacro gen-opts () `(opts:define-opts - (:name :help - :description (_ "Print help and exit") - :short #\h - :long "help") - (:name :version - :description (_ "Print program information and exit") - :short #\v - :long "version") - (:name :folder - :description (_ "Starting folder") - :short #\f - :arg-parser #'identity - :meta-var (_ "FOLDER-NAME") - :long "folder") - (:name :timeline - :description (_ "Starting timeline") - :short #\t - :meta-var (_ "TIMELINE-NAME") - :arg-parser #'identity - :long "timeline") - (:name :update-timeline - :description (_ "Update timeline") - :short #\u - :long "update-timeline") - (:name :reset-timeline-pagination - :description (_ "Reset the timeline pagination") - :short #\R - :long "reset-timeline-pagination") - (:name :check-follows-requests - :description (_ "Check follows requests") - :short #\c - :long "check-follows-requests") - (:name :execute - :description (_ "Execute script") - :short #\e - :arg-parser #'identity - :meta-var (_ "SCRIPT-FILE") - :long "execute-script") - (:name :notify-mentions - :description (_ "Notify messages that mentions the user") - :short #\m - :long "notify-mentions") - (:name :open-gemini-url - :description (_ "Open gemini url") - :short #\o - :arg-parser #'identity - :long "open-gemini-url"))) + (:name :help + :description (_ "Print help and exit") + :short #\h + :long "help") + (:name :version + :description (_ "Print program information and exit") + :short #\v + :long "version") + (:name :folder + :description (_ "Starting folder") + :short #\f + :arg-parser #'identity + :meta-var (_ "FOLDER-NAME") + :long "folder") + (:name :timeline + :description (_ "Starting timeline") + :short #\t + :meta-var (_ "TIMELINE-NAME") + :arg-parser #'identity + :long "timeline") + (:name :update-timeline + :description (_ "Update timeline") + :short #\u + :long "update-timeline") + (:name :reset-timeline-pagination + :description (_ "Reset the timeline pagination") + :short #\R + :long "reset-timeline-pagination") + (:name :check-follows-requests + :description (_ "Check follows requests") + :short #\c + :long "check-follows-requests") + (:name :execute + :description (_ "Execute script") + :short #\e + :arg-parser #'identity + :meta-var (_ "SCRIPT-FILE") + :long "execute-script") + (:name :notify-mentions + :description (_ "Notify messages that mentions the user") + :short #\m + :long "notify-mentions") + (:name :open-gemini-url + :description (_ "Open gemini url") + :short #\o + :arg-parser #'identity + :long "open-gemini-url") + (:name :load-module + :description (_ "Load a module") + :short #\M + :meta-var (_ "MODULE-FILE") + :arg-parser #'identity + :long "load-module"))) (defparameter *start-folder* nil) @@ -78,6 +84,8 @@ (defparameter *script-file* nil) +(defparameter *module-file* nil) + (defparameter *check-follow-requests* nil) (defparameter *reset-timeline-pagination* nil) @@ -119,6 +127,8 @@ (setf *update-timeline* t)) (when (getf options :execute) (setf *script-file* (getf options :execute))) + (when (getf options :load-module) + (setf *module-file* (getf options :load-module))) (when (getf options :check-follows-requests) (setf *check-follow-requests* (getf options :check-follows-requests))) (when (getf options :notify-mentions) diff --git a/src/hooks.lisp b/src/hooks.lisp index 2578214..6353f7f 100644 --- a/src/hooks.lisp +++ b/src/hooks.lisp @@ -51,15 +51,15 @@ run." (with-hook-restart (apply fn args))))) -(defgeneric run-hook-compose (hook &rest args) +(defgeneric run-hook-compose (hook args) (:documentation "Apply first function in HOOK to ARGS, second hook to the results of first function applied and so on, returns the results of af the last hook.") - (:method ((*hook* symbol) &rest args) + (:method ((*hook* symbol) args) (let ((results args)) (dolist (fn (symbol-value *hook*)) (with-hook-restart - (setf results (apply fn results)))) + (setf results (funcall fn results)))) results))) (defgeneric run-hook-until-failure (hook &rest args) diff --git a/src/main.lisp b/src/main.lisp index ba4bfb1..1172c58 100644 --- a/src/main.lisp +++ b/src/main.lisp @@ -134,6 +134,8 @@ etc.) happened" (if command-line:*gemini-url* (load-gemini-url command-line:*gemini-url*) (progn + (when command-line:*module-file* + (modules:load-module command-line:*module-file*)) (let ((program-events:*process-events-immediately* t)) (when command-line:*start-timeline* (change-timeline)) diff --git a/src/package.lisp b/src/package.lisp index b27e042..97ae2c6 100644 --- a/src/package.lisp +++ b/src/package.lisp @@ -1172,6 +1172,7 @@ :*start-timeline* :*update-timeline* :*script-file* + :*module-file* :*check-follow-requests* :*reset-timeline-pagination* :*notify-mentions*