aboutsummaryrefslogtreecommitdiff
path: root/module/entry-points/text.scm
blob: 69bb16913f28649e18fd595287b893f4c532d0a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
(define-module (entry-points text)
  :export (main)
  :use-module (output text)
  :use-module (ice-9 getopt-long)
  :use-module (util io)
  )


(define options
  '((width (value #t) (single-char #\w))
    (file (value #t) (single-char #\f))
    ))

(define (main args)
  (define opts (getopt-long args options))

  (for-each (lambda (l) (display l) (newline))
            (flow-text
             (with-input-from-port (open-input-port (option-ref opts 'file "-"))
               (@ (ice-9 rdelim) read-string))
             #:width (or (string->number (option-ref opts 'width "")) 70))))