From bf781ee291f2c947ccd6bcc3f6bafee9fdb5ffa3 Mon Sep 17 00:00:00 2001 From: cage Date: Sat, 5 Feb 2022 16:24:37 +0100 Subject: [PATCH] - allowed opending kami address from command line, using '-o' switch. --- src/command-line.lisp | 2 +- src/main.lisp | 2 +- src/ui-goodies.lisp | 13 +++++++------ 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/command-line.lisp b/src/command-line.lisp index 016619e..3c8bb74 100644 --- a/src/command-line.lisp +++ b/src/command-line.lisp @@ -68,7 +68,7 @@ :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 diff --git a/src/main.lisp b/src/main.lisp index 5b06774..bb2d536 100644 --- a/src/main.lisp +++ b/src/main.lisp @@ -166,7 +166,7 @@ etc.) happened" command-line:*module-file*) :as-error t)))) (if command-line:*gemini-url* - (gemini-viewer:load-gemini-url command-line:*gemini-url*) + (ui:open-net-address command-line:*gemini-url*) (progn (let ((program-events:*process-events-immediately* t)) (when command-line:*start-timeline* diff --git a/src/ui-goodies.lisp b/src/ui-goodies.lisp index 4588175..5b00cda 100644 --- a/src/ui-goodies.lisp +++ b/src/ui-goodies.lisp @@ -1923,7 +1923,7 @@ mot recent updated to least recent" open-message-link-window:open-message-link" (_ "Open url: ")) -(defun open-net-address () +(defun open-net-address (&optional (address nil)) "Ask for an internet address and try to load it. Currently the only recognized protocols are gemini and kami." (flet ((on-input-complete (url) @@ -1931,11 +1931,12 @@ Currently the only recognized protocols are gemini and kami." (if (text-utils:string-starts-with-p kami:+kami-scheme+ trimmed-url) (open-kami-address trimmed-url) (open-gemini-address trimmed-url))))) - (let ((prompt (open-url-prompt))) - (ask-string-input #'on-input-complete - :prompt prompt - :complete-fn (complete:make-complete-gemini-iri-fn prompt))))) - + (if (null address) + (let ((prompt (open-url-prompt))) + (ask-string-input #'on-input-complete + :prompt prompt + :complete-fn (complete:make-complete-gemini-iri-fn prompt))) + (on-input-complete address)))) (defun open-gemini-address (url) (gemini-viewer:load-gemini-url url