1
0
Fork 0

- made optional character '#' when specifying a starting folder from command line (option '-f').

This commit is contained in:
cage 2024-10-13 12:24:10 +02:00
parent ee6136a884
commit d3fed5aff6
5 changed files with 34 additions and 13 deletions

View File

@ -222,6 +222,8 @@
(set-option-variable options :gemini-gui-server *rpc-server-mode*)
(set-option-variable options :gemini-gui *rpc-client-mode*)
(set-option-variable options :folder *start-folder*)
(when (string-not-empty-p *start-folder*)
(setf *start-folder* (db:add-folder-prefix *start-folder*)))
(set-option-variable options :open-net-address *net-address*)
(set-option-variable options :timeline *start-timeline*)
(set-option-variable options :reset-timeline-pagination *reset-timeline-pagination*)

View File

@ -3527,3 +3527,12 @@ Note: `status-id' must identify at least a row in the database."
(progn
(db:update-db (api-client:get-remote-status parent-id))
(get-cache parent-id))))))
(defun has-folder-prefix-p (string)
(starts-with-prefix-p +folder-tag-prefix+ string))
(defun add-folder-prefix (folder-name)
(add-prefix-once +folder-tag-prefix+ folder-name))
(defun strip-folder-prefix (maybe-folder)
(strip-prefix +folder-tag-prefix+ maybe-folder))

View File

@ -19,18 +19,13 @@
(define-constant +temp-mention-prefix+ "/at/" :test #'string=)
(defun mention-p (maybe-mention)
(scan (strcat "^" +mention-prefix+)
maybe-mention))
(starts-with-prefix-p +mention-prefix+ maybe-mention))
(defun add-mention-prefix (username)
(if (mention-p username)
username
(strcat +mention-prefix+ username)))
(add-prefix-once +mention-prefix+ username))
(defun strip-mention-prefix (maybe-mention)
(if (not (mention-p maybe-mention))
maybe-mention
(subseq maybe-mention (length +mention-prefix+))))
(strip-prefix +mention-prefix+ maybe-mention))
(defun find-first-mention-in-message (message-body)
(when message-body

View File

@ -455,6 +455,9 @@
:+integer-regexp+
:*blanks*
:uchar-length
:starts-with-prefix-p
:strip-prefix
:add-prefix-once
:utf8-encoded-p
:clean-unprintable-chars
:to-s
@ -1205,7 +1208,10 @@
:gempub-metadata-find
:gempub-metadata-id->path
:gempub-metadata-id->row
:get-parent-status-row))
:get-parent-status-row
:has-folder-prefix-p
:add-folder-prefix
:strip-folder-prefix))
(defpackage :date-formatter
(:use

View File

@ -38,6 +38,19 @@
(a:define-constant +integer-regexp+ "0|[1-9][0-9]+|[1-9]" :test 'string=)
(defun starts-with-prefix-p (prefix string)
(cl-ppcre:scan (strcat "^" prefix) string))
(defun strip-prefix (prefix string)
(if (starts-with-prefix-p prefix string)
(subseq string (length prefix))
string))
(defun add-prefix-once (prefix string)
(if (starts-with-prefix-p prefix string)
string
(strcat prefix string)))
(defun uchar-length (leading-byte)
(let ((ones (do* ((ct 7 (1- ct))
(bit (ldb (byte 1 ct) leading-byte)
@ -110,10 +123,6 @@
(declare (optimize (debug 0) (safety 0) (speed 3)))
(reduce (lambda (a b) (concatenate 'string a b)) chunks))
(defun strip-prefix (string prefix)
(let ((re (strcat "^" prefix)))
(cl-ppcre:regex-replace re string "")))
(defun strip-withespaces (string)
(let ((re "\\s"))
(cl-ppcre:regex-replace re string "")))