From 28917208d6bcd9bda4df5d5202c60865217039fe Mon Sep 17 00:00:00 2001 From: cage Date: Tue, 23 Jun 2020 15:51:43 +0200 Subject: [PATCH] - added a command line option to retrieve a gemini URL. --- doc/man.org | 1 + doc/tinmop.man | 3 +++ po/it.po | 12 ++++++++---- po/tinmop.pot | 10 +++++++--- src/command-line.lisp | 12 ++++++++++-- src/main.lisp | 27 ++++++++++++++++----------- src/package.lisp | 1 + 7 files changed, 46 insertions(+), 20 deletions(-) diff --git a/doc/man.org b/doc/man.org index 472ee14..338827f 100644 --- a/doc/man.org +++ b/doc/man.org @@ -20,6 +20,7 @@ Without options the program will start a terminal interface and will try to connect to your instance (see [[Configuration]]) + + -o, --open-gemini-url ARG :: Open gemini url + -m, --notify-mentions ARG :: Notify messages that mentions the user + -R, --reset-timeline-pagination :: Reset the timeline pagination. By default the new toots are fetched diff --git a/doc/tinmop.man b/doc/tinmop.man index f5131de..b6809c3 100644 --- a/doc/tinmop.man +++ b/doc/tinmop.man @@ -23,6 +23,9 @@ social network Without options the program will start a terminal interface and will try to connect to your instance (see \fIConfiguration\fP) +.TP +\fB-o, --open-gemini-url ARG \fP +Open gemini url .TP \fB-m, --notify-mentions ARG \fP Notify messages that mentions the user diff --git a/po/it.po b/po/it.po index 8269108..2a5c475 100644 --- a/po/it.po +++ b/po/it.po @@ -8,8 +8,8 @@ msgid "" msgstr "" "Project-Id-Version: tinmop 0.0.1\n" "Report-Msgid-Bugs-To: https://notabug.org/cage/tinmop/\n" -"POT-Creation-Date: 2020-06-23 11:19+0200\n" -"PO-Revision-Date: 2020-06-23 11:19+0200\n" +"POT-Creation-Date: 2020-06-23 15:48+0200\n" +"PO-Revision-Date: 2020-06-23 15:49+0200\n" "Last-Translator: cage \n" "Language-Team: Italian\n" "Language: it\n" @@ -126,6 +126,10 @@ msgstr "SCRIPT-FILE" msgid "Notify messages that mentions the user" msgstr "Notifica i messaggi che menzionano l'utente." +#: src/command-line.lisp:69 +msgid "Open gemini url" +msgstr "Apri un indirizzo gemini" + #: src/command-window.lisp:299 #, lisp-format msgid "Error: command ~a not found" @@ -190,12 +194,12 @@ msgstr "" "La firma dell'host ~s è cambiata! Questo è un potenziale problema di " "sicurezza! Proseguire? [s/N]" -#: src/gemini-viewer.lisp:98 src/tui-utils.lisp:478 +#: src/gemini-viewer.lisp:97 src/tui-utils.lisp:478 #, lisp-format msgid "Error: ~a" msgstr "Errore: ~a" -#: src/gemini-viewer.lisp:103 +#: src/gemini-viewer.lisp:104 #, lisp-format msgid "Error getting ~s: ~a" msgstr "Errore connettendomi a ~s: ~a" diff --git a/po/tinmop.pot b/po/tinmop.pot index ce49dab..3e25894 100644 --- a/po/tinmop.pot +++ b/po/tinmop.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: tinmop 0.0.9\n" "Report-Msgid-Bugs-To: https://notabug.org/cage/tinmop/\n" -"POT-Creation-Date: 2020-06-23 11:19+0200\n" +"POT-Creation-Date: 2020-06-23 15:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -122,6 +122,10 @@ msgstr "" msgid "Notify messages that mentions the user" msgstr "" +#: src/command-line.lisp:69 +msgid "Open gemini url" +msgstr "" + #: src/command-window.lisp:299 #, lisp-format msgid "Error: command ~a not found" @@ -181,12 +185,12 @@ msgid "" "warning? [y/N] " msgstr "" -#: src/gemini-viewer.lisp:98 src/tui-utils.lisp:478 +#: src/gemini-viewer.lisp:97 src/tui-utils.lisp:478 #, lisp-format msgid "Error: ~a" msgstr "" -#: src/gemini-viewer.lisp:103 +#: src/gemini-viewer.lisp:104 #, lisp-format msgid "Error getting ~s: ~a" msgstr "" diff --git a/src/command-line.lisp b/src/command-line.lisp index c9c95b5..f7212e7 100644 --- a/src/command-line.lisp +++ b/src/command-line.lisp @@ -64,8 +64,12 @@ :description (_ "Notify messages that mentions the user") :short #\m :arg-parser #'identity - :long "notify-mentions"))) - + :long "notify-mentions") + (:name :open-gemini-url + :description (_ "Open gemini url") + :short #\o + :arg-parser #'identity + :long "open-gemini-url"))) (defparameter *start-folder* nil) @@ -81,6 +85,8 @@ (defparameter *notify-mentions* nil) +(defparameter *gemini-url* nil) + (defparameter *update-timeline-climb-message-tree* nil) (defun exit-on-error (e) @@ -102,6 +108,8 @@ (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) diff --git a/src/main.lisp b/src/main.lisp index ec8d563..4ee051d 100644 --- a/src/main.lisp +++ b/src/main.lisp @@ -116,17 +116,22 @@ etc.) happened" ;; now init the client (client:init) (client:authorize) - (let ((program-events:*process-events-immediately* t)) - (when command-line:*start-timeline* - (change-timeline)) - (when command-line:*start-folder* - (change-folder))) - (when command-line:*reset-timeline-pagination* - (reset-timeline-pagination)) - (when command-line:*update-timeline* - (ui:update-current-timeline)) - (when command-line:*check-follow-requests* - (ui:start-follow-request-processing)))) + (if command-line:*gemini-url* + (progn + (gemini-viewer:request *gemini-url*) + (ui:focus-to-message-window)) + (progn + (let ((program-events:*process-events-immediately* t)) + (when command-line:*start-timeline* + (change-timeline)) + (when command-line:*start-folder* + (change-folder))) + (when command-line:*reset-timeline-pagination* + (reset-timeline-pagination)) + (when command-line:*update-timeline* + (ui:update-current-timeline)) + (when command-line:*check-follow-requests* + (ui:start-follow-request-processing)))))) (defun run () (windows:with-croatoan-window (croatoan-window specials:*main-window*) diff --git a/src/package.lisp b/src/package.lisp index ea47cfc..5019849 100644 --- a/src/package.lisp +++ b/src/package.lisp @@ -1066,6 +1066,7 @@ :*check-follow-requests* :*reset-timeline-pagination* :*notify-mentions* + :*gemini-url* :*update-timeline-climb-message-tree* :manage-opts))