guix-cantrips/scripts/guix-cantrips.in

72 lines
2.4 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)
(guix-cantrips summon)
(ice-9 exceptions)
(ice-9 match)
(srfi srfi-26))
;; Commandline handling
(define %configuration
(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")))
(handler canonicalize-path)
(synopsis "Directory to download source code to")
(example "~/src"))
(setting (name 'with-manifest)
(default #f)
(test boolean?)
(synaopsis "Create a manifest file with the package's development dependencies"))
(setting (name 'with-guix-file)
(default #f)
(test boolean?)
(synaopsis "Create a local version of the package's definition in guix.scm"))))
(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 with-manifest with-guix-file))))
(arguments
(list
(argument (name 'package)
(synopsis "name of the package to download the source of")
(example "hello")))))))
(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")
(summon options))))
;;; Local Variables:
;;; mode: scheme
;;; End: