84 lines
3.0 KiB
Plaintext
84 lines
3.0 KiB
Plaintext
#!@GUILE@ \
|
|
--no-auto-compile -e main -s
|
|
!#
|
|
|
|
;; bin/guix-cantrips --- guix-cantrips cli -*- coding: utf-8 -*-
|
|
|
|
(use-modules (config)
|
|
(config api)
|
|
(config licenses)
|
|
(config parser sexp)
|
|
(ice-9 exceptions)
|
|
(ice-9 match)
|
|
(srfi srfi-26))
|
|
|
|
;; Commandline handling
|
|
|
|
(define %configuration
|
|
(let* ((csv-test (match-lambda (((? string?) ...) #t)
|
|
(_ #f)))
|
|
(csv-test-allow-empty (λ (a)
|
|
(or (csv-test a)
|
|
(string=? a ""))))
|
|
(csv-handler (cut string-split <> #\,))
|
|
(manifest-exists?
|
|
(λ (path opts)
|
|
(file-exists? (format #f "~a/~a"
|
|
(option-ref opts 'config-dir)
|
|
path)))))
|
|
(configuration
|
|
(name 'guix-cantrips)
|
|
(version @HVERSION@)
|
|
(author @AUTHOR@)
|
|
(copyright @COPYRIGHT@)
|
|
(license @LICENSE@)
|
|
(synopsis "Utilities and modules to make guix even more magical")
|
|
(description "guix-cantrips provides function to quickly get source code from packages and set the repo up to get going FAST")
|
|
(keywords
|
|
(list
|
|
(setting (name 'project-dir)
|
|
(default (format #f "~a/src"
|
|
(getenv "HOME")))
|
|
(test file-exists?)
|
|
(handler canonicalize-path)
|
|
(synopsis "Directory to download source code to")
|
|
(example "~/src"))
|
|
(setting (name 'config-dir)
|
|
(default (or (getenv "XDG_CONFIG_HOME")
|
|
(format #f "~a/.config" (getenv "HOME"))))
|
|
(test file-exists?)
|
|
(handler canonicalize-path)
|
|
(synopsis "Directory to search for profile manifests")
|
|
(example "~/.config/guix-conjure"))))
|
|
(subcommands
|
|
(list
|
|
(configuration
|
|
(name 'summon)
|
|
(synopsis "Retrieves the source code of a package, and places it within the project directory, while configuring all permissions.")
|
|
(description
|
|
"Uses guix build --source to obtain a package's source code, decompressing if required, and places the resulting source in the project directory.")
|
|
(wanted '((keywords project-dir)))
|
|
(arguments
|
|
(list
|
|
(argument (name 'package)
|
|
(test csv-test)
|
|
(handler csv-handler)
|
|
(synopsis "name of the package to download the source of")
|
|
(example "guix")))))))
|
|
(directory (in-home ".config/"))
|
|
(parser simple-sexp-parser)
|
|
(generate-cmdtree? #t))))
|
|
|
|
(define (main args)
|
|
"(Listof String) -> Int
|
|
program entrypoint; handle commandline args and call appropriate procedures"
|
|
(define options (getopt-config-auto args %configuration))
|
|
(match (full-command options)
|
|
((_ "summon")
|
|
((λ (options) ()) options))))
|
|
|
|
|
|
;;; Local Variables:
|
|
;;; mode: scheme
|
|
;;; End:
|