#lang racket ;;; SPDX-License-Identifier: LGPL-3.0-or-later ;;; SPDX-FileCopyrightText: Copyright © 2017-2022 Tony Garnock-Jones (module+ main (require racket/cmdline) (require "../types.rkt") (require "../read.rkt") (require "../render.rkt") (define config (render-config)) (define *target* 'screen) (define-syntax-rule (! [fld val] ...) (set! config (struct-copy config [fld val] ...))) (define filename (command-line #:once-each [("-s" "--scale") scale "Rescales output; 1 = 100%" (! [scale (string->number scale)])] [("-t" "--target") target "Choose target: screen, png, png@2x, svg, eps, pdf" (set! *target* (string->symbol target))] [("--width") width ((format "Width of swimlane cells (default: ~a)" (render-config-width config))) (! [width (string->number width)])] [("--height") height ((format "Minimum height of rows (default: ~a)" (render-config-width config))) (! [height (string->number height)])] [("--gap") gap ((format "Extra space between rows (default: ~a)" (render-config-gap config))) (! [gap (string->number gap)])] [("--number") "Enables step numbering" (! [number-steps? #t])] [("--no-number") "Disables step numbering" (! [number-steps? #f])] [("--number-gap") number-gap ((format "Extra space to row numbers (default: ~a)" (render-config-number-gap config))) (! [number-gap (string->number number-gap)])] #:args (filename) filename)) (define (read-input port) (read-msd port #:config config)) (define msd (if (equal? filename "-") (read-input (current-input-port)) (call-with-input-file filename read-input))) (render (msd->pict msd #:config config) #:target *target*))