summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2021-08-22 16:11:59 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2021-08-22 16:11:59 +0200
commitbd00e07648d0941cee7f5a95b72d413908e9634e (patch)
tree7ffc8df70b0cd51e41098e1b0cfeb4d2be442680
parentInitial commit. (diff)
downloadrss-filter-bd00e07648d0941cee7f5a95b72d413908e9634e.tar.gz
rss-filter-bd00e07648d0941cee7f5a95b72d413908e9634e.tar.xz
Add --output option.
-rwxr-xr-xmain.scm10
1 files changed, 9 insertions, 1 deletions
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