#!@GUILE@ \ --no-auto-compile -e main -s !# ;; bin/env --- env cli -*- coding: utf-8 -*- ;; ;; Copyright (C) 2023 by Davie Li ;; ;; Author: 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 (($ 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))) (($ 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 ' to mount `current' tag to ~/env/ ")))) ;;; Local Variables: ;;; mode: scheme ;;; End: