A colleague needed to make QR codes so I made a command line tool.
I installed simple-qr with raco package install,
then I searched for and installed the drracket-cmdline-args DrRacket plugin using graphical package manager in DrRacket so I could test it.
Once complete I used 'Create Executable' in DrRacket to create a version my colleague could use on their machine
#lang racket/base
(require simple-qr)
(define (main)
(define (my-error text)
(fprintf (current-error-port) "Error: ~a\n" text))
(define args (current-command-line-arguments))
(when (not (= (vector-length args) 2))
(my-error "Usage: qr <url> <filename>")
(exit 1))
(define url-str (vector-ref args 0))
(define filename (vector-ref args 1))
(with-handlers ([exn:fail?
(lambda (e)
(fprintf (current-error-port)
"Error: ~a\n"
(exn-message e))
(exit 1))])
(qr-write url-str filename)) ;(qr-write "https://www.something.com/" "myqr.png")
(displayln (string-append "QR code for " url-str " to " filename " as PNG")))
(main)
Could not have done this without the Racket community ![]()