From 670b9b86d6f09aff856104e1d8c903005b6ba7f4 Mon Sep 17 00:00:00 2001 From: Jaidyn Ann <10477760+JadedCtrl@users.noreply.github.com> Date: Fri, 9 Feb 2024 00:09:28 -0600 Subject: [PATCH] Opening vCard file as free cli argument Now you can run, ex., $ ./contact ~/whatever.vcf --- contact.scm | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/contact.scm b/contact.scm index 786c02c..22bbc3f 100644 --- a/contact.scm +++ b/contact.scm @@ -54,15 +54,18 @@ (thread-start! (lambda () (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. - (repl) - ;; Wait for the QT program, even after stdin is closed off. - (thread-join! qt-thread)))) + (repl) + ;; Wait for the QT program, even after stdin is closed off. + (thread-join! qt-thread)))) ;; Print a “usage” help message, telling the user how to run the program. (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 (pathname-file (program-name)) " is a simple contacts program for managing") (print "vCard-format contacts.") @@ -176,7 +179,6 @@ ;; (ADR ("TYPE=home") ("" "" "1234 Abc.", "", "", "", ""))) (define (populate-with-vcard window vcard-alist) (map (lambda (property) - (print property) (let* [(formname (alist-ref (car property) property->formname-alist)) (lineEditName (conc formname "LineEdit")) (lineEditWidget (if formname (qt:find window lineEditName) #f))] @@ -185,7 +187,4 @@ vcard-alist)) - - - (init)