ordo/examples/interceptor.scm

33 lines
880 B
Scheme

(use-modules
(ice-9 filesystem)
(srfi srfi-2)
(srfi srfi-71)
(logging logger)
(ordo connection)
(ordo interceptor)
(ordo interceptor install-file)
(ordo interceptor create-tmp-dir)
(ordo interceptor stat-file)
(ordo interceptor user-info)
(ordo interceptor debug)
(ordo logger))
(define chain
(list (connection-interceptor (local-connection))
(create-tmp-dir #:register 'tmp-dir)
(user-info)
(debug-vars 'user-info)
(install-file
"install-hello"
#:path (let-vars (tmp-dir) (file-name-join* tmp-dir "hello.txt"))
#:content "Hello, world!\n"
#:register 'hello)
(stat-file
"stat-hello"
#:path (let-vars (hello) hello)
#:register 'hello-stat)
(debug-vars 'hello 'hello-stat)))
(setup-logging #:level 'INFO)
(execute (init-context) chain)
(shutdown-logging)