ordo/ordo.scm
2025-05-29 16:57:26 +01:00

48 lines
1.2 KiB
Scheme
Executable file

#!/usr/bin/guile \
--no-auto-compile -e main -s
!#
(use-modules (config)
(config api)
(config parser sexp)
(ice-9 format)
(ice-9 match)
((ordo cli run) #:prefix run:)
(ordo logger))
(define config
(configuration
(name 'ordo)
(synopsis "From chaos, comes order")
(description "Ordo configuration management.")
(keywords
(list
(setting
(name 'log-level)
(handler string->symbol)
(test valid-log-level?)
(default 'NOTICE)
(example "DEBUG|INFO|NOTICE|WARN|ERROR")
(synopsis "Log level"))))
(parser sexp-parser)
(directory (in-cwd ".config/" #t))
(version "0.1.0")
(author "Ray Miller")
(license gpl3+)
(copyright (list 2025))
(subcommands
(list
run:config))))
(define (main cmd-line)
(let ((options (getopt-config-auto cmd-line config)))
(dynamic-wind
(lambda ()
(setup-logging! #:level (option-ref options 'log-level)))
(lambda ()
(match (full-command options)
(("ordo" "run")
(run:handler options))
(_ (emit-help options))))
(lambda ()
(shutdown-logging!)))))