aboutsummaryrefslogtreecommitdiff
path: root/scripts/guix-build-coordinator-agent.in
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/guix-build-coordinator-agent.in')
-rw-r--r--scripts/guix-build-coordinator-agent.in44
1 files changed, 44 insertions, 0 deletions
diff --git a/scripts/guix-build-coordinator-agent.in b/scripts/guix-build-coordinator-agent.in
index e79f218..eff66e4 100644
--- a/scripts/guix-build-coordinator-agent.in
+++ b/scripts/guix-build-coordinator-agent.in
@@ -22,3 +22,47 @@
;;; along with the guix-data-service. If not, see
;;; <http://www.gnu.org/licenses/>.
+(use-modules (srfi srfi-1)
+ (srfi srfi-37)
+ (guix-build-coordinator agent))
+
+(define %options
+ ;; Specifications of the command-line options
+ (list (option '("coordinator") #t #f
+ (lambda (opt name arg result)
+ (alist-cons 'coordinator
+ arg
+ result)))
+ (option '("uuid") #t #f
+ (lambda (opt name arg result)
+ (alist-cons 'uuid
+ arg
+ result)))
+ (option '("password") #t #f
+ (lambda (opt name arg result)
+ (alist-cons 'password
+ arg
+ result)))))
+
+(define %option-defaults
+ ;; Alist of default option values
+ `((coordinator . "http://localhost:8745")))
+
+(define (parse-options options defaults args)
+ (args-fold
+ args %options
+ (lambda (opt name arg result)
+ (error "unrecognized option" name))
+ (lambda (arg result)
+ (error "unrecognized argument" arg))
+ %option-defaults))
+
+(setvbuf (current-output-port) 'line)
+(setvbuf (current-error-port) 'line)
+
+(let ((opts (parse-options %options
+ %option-defaults
+ (cdr (program-arguments)))))
+ (run-agent (assq-ref opts 'uuid)
+ (assq-ref opts 'coordinator)
+ (assq-ref opts 'password)))