From bd00e07648d0941cee7f5a95b72d413908e9634e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Sun, 22 Aug 2021 16:11:59 +0200 Subject: Add --output option. --- main.scm | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/main.scm b/main.scm index d0459b2..ee3cd60 100755 --- a/main.scm +++ b/main.scm @@ -9,6 +9,7 @@ (sxml xpath) (sxml transform) (ice-9 regex) + (ice-9 getopt-long) ) @@ -39,8 +40,15 @@ (*default* . ,(lambda (item . children) (cons item children))))) ) +(define option-spec + `((output (single-char #\o) + (required? #t) + (value #t)))) + (define (main args) + (define opts (getopt-long args option-spec)) + (define response (http-get "https://lwn.net/headlines/Features" #:streaming? #t)) @@ -50,7 +58,7 @@ (response-code response)) (exit 1)) - (with-output-to-file "lwn-unlocked-features.xml" + (with-output-to-file (option-ref opts 'output #f) (lambda () (sxml->xml (filter-tree -- cgit v1.2.3