From 75a056cce006c296009a33692b82a890acef48c7 Mon Sep 17 00:00:00 2001 From: cage Date: Fri, 12 Nov 2021 10:50:33 +0100 Subject: [PATCH] - added command-line option for gemini fullscreen mode; - cleaned up command line switch management. --- src/command-line.lisp | 43 ++++++++++++++++++++++++------------------- src/package.lisp | 1 + 2 files changed, 25 insertions(+), 19 deletions(-) diff --git a/src/command-line.lisp b/src/command-line.lisp index cb12eb4..6da9a5c 100644 --- a/src/command-line.lisp +++ b/src/command-line.lisp @@ -68,7 +68,12 @@ :description (_ "Open gemini url") :short #\o :arg-parser #'identity - :long "open-gemini-url") + :long "open-gemini-url") + (:name :gemini-full-screen-mode + :description (_ "Start as gemini client only.") + :short #\G + :arg-parser #'identity + :long "gemini-client-only") (:name :load-module :description (_ "Load a module") :short #\M @@ -96,10 +101,18 @@ (defparameter *update-timeline-climb-message-tree* nil) +(defparameter *gemini-full-screen-mode* nil) + (defun exit-on-error (e) (format *error-output* "~a~%" e) (os-utils:exit-program 1)) +(defmacro set-option-variable (options option-name option-variable) + (with-gensyms (option-value) + `(let ((,option-value (getf ,options ,option-name))) + (when ,option-value + (setf ,option-variable ,option-value))))) + (defun manage-opts () (handler-bind ((opts:unknown-option #'exit-on-error) (opts:missing-arg #'exit-on-error) @@ -115,21 +128,13 @@ (when (getf options :version) (print-version) (os-utils:exit-program)) - (when (getf options :folder) - (setf *start-folder* (getf options :folder))) - (when (getf options :open-gemini-url) - (setf *gemini-url* (getf options :open-gemini-url))) - (when (getf options :timeline) - (setf *start-timeline* (getf options :timeline))) - (when (getf options :reset-timeline-pagination) - (setf *reset-timeline-pagination* t)) - (when (getf options :update-timeline) - (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) - (setf *notify-mentions* (getf options :notify-mentions)))))) + (set-option-variable options :folder *start-folder*) + (set-option-variable options :open-gemini-url *gemini-url*) + (set-option-variable options :timeline *start-timeline*) + (set-option-variable options :reset-timeline-pagination *reset-timeline-pagination*) + (set-option-variable options :update-timeline *update-timeline*) + (set-option-variable options :execute *script-file*) + (set-option-variable options :load-module *module-file*) + (set-option-variable options :check-follows-requests *check-follow-requests*) + (set-option-variable options :gemini-full-screen-mode *gemini-full-screen-mode*) + (set-option-variable options :notify-mentions *notify-mentions*)))) diff --git a/src/package.lisp b/src/package.lisp index 5c3fdc3..ce251e9 100644 --- a/src/package.lisp +++ b/src/package.lisp @@ -1334,6 +1334,7 @@ :*notify-mentions* :*gemini-url* :*update-timeline-climb-message-tree* + :*gemini-full-screen-mode* :manage-opts)) (defpackage :specials