Coverage report: /home/ellis/comp/core/lib/cry/authinfo.lisp

KindCoveredAll%
expression1946 41.3
branch00nil
Key
Not instrumented
Conditionalized out
Executed
Not executed
 
Both branches taken
One branch taken
Neither branch taken
1
 ;;; authinfo.lisp --- Gnus Authinfo
2
 
3
 ;; 
4
 
5
 ;;; Commentary:
6
 
7
 ;; ref: https://www.emacswiki.org/emacs/GnusAuthinfo
8
 
9
 ;;; Code:
10
 (in-package :cry/authinfo)
11
 
12
 (defvar *auth-sources* (list #p"~/.authinfo" #p"~/.authinfo.gpg"))
13
 
14
 ;;; Utils
15
 (defun write-authinfo-line (cons stream)
16
   (write-string (car cons) stream)
17
   (write-char #\space stream)
18
   (write-line (cdr cons) stream))
19
 
20
 (defun read-authinfo-line (stream)
21
   (let ((line (read-line stream nil nil)))
22
     line))
23
 
24
 ;;; Obj
25
 (defclass authinfo ()
26
   ((path :type pathname :initarg :path :accessor path)
27
    (credentials :type list :initarg :credentials :accessor credentials)))
28
 
29
 ;; TODO 2024-06-30: 
30
 (defmethod serde ((from authinfo) (to pathname)))
31
 (defmethod serde ((from stream) (to authinfo)))
32
 
33
 (defmethod deserialize ((from pathname) (format (eql :authinfo)) &key)
34
   (make-instance 'authinfo
35
     :path from
36
     :credentials
37
     (remove-if (lambda (x) (char= (char x 0) #\#)) (uiop:read-file-lines from))))
38
 
39
 (defmethod deserialize ((from string) (format (eql :authinfo)) &key)
40
   (make-instance 'authinfo
41
     :credentials (remove-if (lambda (x) (char= (char x 0) #\#)) (split-sequence #\newline from))))