Opening vCard file as free cli argument

Now you can run, ex.,
    $ ./contact ~/whatever.vcf
This commit is contained in:
Jaidyn Ann 2024-02-09 00:09:28 -06:00
parent ab78dba5a3
commit 670b9b86d6

View File

@ -54,6 +54,9 @@
(thread-start! (thread-start!
(lambda () (lambda ()
(nrepl (string->number (alist-ref 'repl cli-args)))))))] (nrepl (string->number (alist-ref 'repl cli-args)))))))]
;; Open the free-argument file.
(if (condition-case (not (null? (last (car cli-args)))) (var () #f))
(open-vcard-file qt-win (last (car cli-args))))
;; … and also provide a local REPL. ;; … and also provide a local REPL.
(repl) (repl)
;; Wait for the QT program, even after stdin is closed off. ;; Wait for the QT program, even after stdin is closed off.
@ -62,7 +65,7 @@
;; Print a “usage” help message, telling the user how to run the program. ;; Print a “usage” help message, telling the user how to run the program.
(define (cli-usage) (define (cli-usage)
(print "usage: " (pathname-file (program-name)) " [-h] [--repl PORT]") (print "usage: " (pathname-file (program-name)) " [-h] [--repl PORT] [VCF_FILE]")
(print) (print)
(print (pathname-file (program-name)) " is a simple contacts program for managing") (print (pathname-file (program-name)) " is a simple contacts program for managing")
(print "vCard-format contacts.") (print "vCard-format contacts.")
@ -176,7 +179,6 @@
;; (ADR ("TYPE=home") ("" "" "1234 Abc.", "", "", "", ""))) ;; (ADR ("TYPE=home") ("" "" "1234 Abc.", "", "", "", "")))
(define (populate-with-vcard window vcard-alist) (define (populate-with-vcard window vcard-alist)
(map (lambda (property) (map (lambda (property)
(print property)
(let* [(formname (alist-ref (car property) property->formname-alist)) (let* [(formname (alist-ref (car property) property->formname-alist))
(lineEditName (conc formname "LineEdit")) (lineEditName (conc formname "LineEdit"))
(lineEditWidget (if formname (qt:find window lineEditName) #f))] (lineEditWidget (if formname (qt:find window lineEditName) #f))]
@ -185,7 +187,4 @@
vcard-alist)) vcard-alist))
(init) (init)