implement command line

This commit is contained in:
xenia 2025-10-09 22:26:01 -04:00
parent 2a1898dedd
commit c013758162
1 changed files with 16 additions and 0 deletions

View File

@ -516,3 +516,19 @@
(hash-set! acc pkg-name 'installed) (hash-set! acc pkg-name 'installed)
(void))) (void)))
(module+ main
(require racket/cmdline)
(define force? (make-parameter #f))
(define base-dir (make-parameter (build-path "racket-catalog")))
(command-line
#:program "racket2nix"
#:once-each
[("-f" "--force") "Overwrite existing nix files" (force? #t)]
[("-d" "--base-dir") bd "Base directory for nix files" (base-dir (bd))]
#:args (pkg . more-pkgs)
(define acc (make-hash))
(for ([pkg (in-list (cons pkg more-pkgs))])
(racket2nix pkg (force?) (base-dir) acc))))