55 lines
1.7 KiB
Text
55 lines
1.7 KiB
Text
#!@GUILE@ \
|
|
--no-auto-compile -e main -s
|
|
!#
|
|
|
|
;; bin/env --- env cli -*- coding: utf-8 -*-
|
|
;;
|
|
;; Copyright (C) 2023 by Davie Li <hello@davie.li>
|
|
;;
|
|
;; Author: Davie Li <hello@davie.li>
|
|
;;
|
|
;; This file is part of guile-env.
|
|
|
|
;;; Commentary:
|
|
;;
|
|
;;; Code:
|
|
|
|
(use-modules (config)
|
|
(env)
|
|
(ice-9 match)
|
|
(srfi srfi-19)
|
|
(srfi srfi-26))
|
|
|
|
(define* (main #:optional (args (command-line)))
|
|
(match (cdr args)
|
|
(("list") (for-each
|
|
(match-lambda (($ <environment> name current root tags tree)
|
|
(format (current-output-port)
|
|
"~a tags: ~a current: ~a root: ~a\n"
|
|
name
|
|
(string-join (map symbol->string tags) " ")
|
|
(string-take current 7)
|
|
(string-take root 7))))
|
|
(list-environments)))
|
|
(("mount" name) (match (mount-environment
|
|
(lookup-environment (string->symbol name)))
|
|
(($ <overlay-mount> lower upper work merged)
|
|
|
|
(format (current-output-port)
|
|
"\
|
|
Mounted environment ~a at ~a
|
|
upperdir: ~a
|
|
workdir: ~a\n"
|
|
(string->symbol name) merged
|
|
upper work))
|
|
(else (display "\
|
|
Unknown error, go figure it out inside REPL.\n"))))
|
|
(else (display "\
|
|
Use `env list' to list current environments
|
|
Use `env mount <name>' to mount `current' tag to ~/env/<name>
|
|
"))))
|
|
|
|
;;; Local Variables:
|
|
;;; mode: scheme
|
|
;;; End:
|