Mercurial > core / lisp/lib/cli/tools/term.lisp
changeset 496: |
6359b351657a |
parent: |
33b0614ee220
|
author: |
Richard Westhaver <ellis@rwest.io> |
date: |
Mon, 01 Jul 2024 15:50:23 -0400 |
permissions: |
-rw-r--r-- |
description: |
tmux controller, cli upgrades |
1 ;;; term.lisp --- Terminal Tools 3 ;; Control and spawn terminal consoles from Lisp. 7 ;; This package is intended to make it easier to work with interactive 8 ;; terminal programs in a Lispy manner. 11 (in-package :cli/tools/term) 13 (deferror terminal-error (simple-error error) ()) 15 (defun terminal-error (fmt &rest args) 16 (error 'terminal-error :format-arguments args :format-control fmt)) 18 (defparameter *terminal* (or (find-exe "alacritty") (find-exe "xterm"))) 20 (defparameter *alacritty-config-path* (merge-pathnames ".config/alacritty.toml" (user-homedir-pathname))) 22 (defun run-terminal (&rest args) 23 (apply #'sb-ext:run-program *terminal* args)) 25 (defmacro with-terminal ((sym &key args input output) &body body) 26 `(let ((,sym (run-terminal ,args 27 ,@(when input '(:input :stream)) 28 ,@(when output '(:output :stream)) 30 (let (,@(when input `((,input (sb-ext:process-input ,sym)))) 31 ,@(when output `((,output (sb-ext:process-output ,sym)))))