diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2022-02-22 11:19:19 +0100 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2022-02-22 21:08:41 +0100 |
commit | 093ef72e6489d96fb6ffae8d58d7cb1cb7ff77ee (patch) | |
tree | d164e37c20e562588700d86379cfda1b0ca3c596 /module/calp/entry-points/text.scm | |
parent | Datetime restrict imports. (diff) | |
download | calp-093ef72e6489d96fb6ffae8d58d7cb1cb7ff77ee.tar.gz calp-093ef72e6489d96fb6ffae8d58d7cb1cb7ff77ee.tar.xz |
Prepare code for translation.
Diffstat (limited to 'module/calp/entry-points/text.scm')
-rw-r--r-- | module/calp/entry-points/text.scm | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/module/calp/entry-points/text.scm b/module/calp/entry-points/text.scm index 0a5744b3..921afb80 100644 --- a/module/calp/entry-points/text.scm +++ b/module/calp/entry-points/text.scm @@ -4,16 +4,18 @@ :use-module (ice-9 getopt-long) :use-module (hnh util io) :use-module (hnh util options) + :use-module (calp translation) + :use-module (sxml simple) ) (define options - '((width (value #t) (single-char #\w) - (description "Width of written text, defaults to 70 chars.")) + `((width (value #t) (single-char #\w) + (description ,(_ "Width of written text, defaults to 70 chars."))) (file (value #t) (single-char #\f) - (description "Read from " (i "file") " instead of standard input.")) + (description ,(xml->sxml (_ "<group>Read from <i>file</i> instead of standard input.</group>")))) (help (single-char #\h) - (description "Prints this help.")))) + (description ,(_ "Prints this help."))))) (define (main args) (define opts (getopt-long args (getopt-opt options))) @@ -24,6 +26,9 @@ (for-each (lambda (l) (display l) (newline)) (flow-text - (with-input-from-port (open-input-port (option-ref opts 'file "-")) + (with-input-from-port (let ((fname (option-ref opts 'file "-"))) + (if (string=? fname "-") + (current-input-port) + (open-input-file fname))) (@ (ice-9 rdelim) read-string)) #:width (or (string->number (option-ref opts 'width "")) 70)))) |