1
0
mirror of https://codeberg.org/cage/tinmop/ synced 2025-03-04 10:07:38 +01:00

- Added a command line switch to load a module.

- fixed 'run-hook-compose'.
This commit is contained in:
cage 2020-12-31 15:35:12 +01:00
parent 8dae8ddac2
commit a3c2550ff4
4 changed files with 63 additions and 50 deletions

View File

@ -68,7 +68,13 @@
:description (_ "Open gemini url")
:short #\o
:arg-parser #'identity
:long "open-gemini-url")))
: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)

View File

@ -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)

View File

@ -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))

View File

@ -1172,6 +1172,7 @@
:*start-timeline*
:*update-timeline*
:*script-file*
:*module-file*
:*check-follow-requests*
:*reset-timeline-pagination*
:*notify-mentions*