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:
parent
8dae8ddac2
commit
a3c2550ff4
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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))
|
||||
|
@ -1172,6 +1172,7 @@
|
||||
:*start-timeline*
|
||||
:*update-timeline*
|
||||
:*script-file*
|
||||
:*module-file*
|
||||
:*check-follow-requests*
|
||||
:*reset-timeline-pagination*
|
||||
:*notify-mentions*
|
||||
|
Loading…
x
Reference in New Issue
Block a user