changelog shortlog graph tags branches changeset files revisions annotate raw help

Mercurial > core / lisp/lib/cli/pkg.lisp

changeset 586: 7ce855f76e1d
parent: 5540a3e32ba1
child: 926d95e5fdc7
author: Richard Westhaver <ellis@rwest.io>
date: Sun, 11 Aug 2024 01:53:06 -0400
permissions: -rw-r--r--
description: net/fetch upgrades, fixes, net/err -> net/condition
1 ;;; cli.lisp --- cli programming api and utils
2 
3 ;; This package contains a simple api and macros for building lisp CLI
4 ;; programs.
5 
6 ;;; Commentary:
7 
8 ;; - inspired by: clingon, uiop
9 
10 ;; Basic assumptions at runtime:
11 ;; - running in a POSIX-compliant shell
12 ;; - output stream supports UTF-8
13 
14 ;; TODO 2023-10-14: install-ast, install-thunk, proc-args, etc should
15 ;; return IR types - CLI-IR THUNK and CLI-IR respectively.
16 
17 ;; TODO 2023-10-14: rename cli-ast to cli-ir, install-ast to
18 ;; install-ir, etc.
19 
20 ;;; Code:
21 (defpackage :cli/shell
22  (:use :cl :std)
23  (:nicknames :shell)
24  (:export :*shell* :*shell-directory* :*shell-input*))
25 
26 (defpackage :cli/env
27  (:use :cl :std)
28  (:export :*default-global-env-var-names* :*default-local-env-var-names* :exec-path-list
29  :program-list :find-exe :ld-library-path-list :concat-env-table
30  :make-env-var))
31 
32 (defpackage :cli/ansi
33  (:use :cl :std)
34  (:nicknames :ansi)
35  (:export
36  ;; ESC sequences
37  :.ris :reset-to-initial-state
38  ;; CSI sequences | cursor control
39  :.cuu :cursor-up
40  :.cud :cursor-down
41  :.cuf :cursor-forward
42  :.cub :cursor-backward
43  :.cnl :cursor-next-line
44  :.cpl :cursor-preceding-line
45  :.cha :cursor-horizontal-absolute
46  :.cup :cursor-position
47  :.vpa :vertical-position-absolute
48  :.vpr :vertical-position-relative
49  :.vpb :vertical-position-backward
50  :.scosc :save-cursor-position
51  :.scorc :restore-cursor-position
52  :.ed :erase-in-display :erase-below :erase-above :erase :erase-saved-lines
53  :.el :erase-in-line :erase-right :erase-left :erase-line
54  :.sgr :select-graphic-rendition
55  :.dsr :device-status-report
56  ;; DEC private mode set and reset
57  :.decset :dec-private-mode-set
58  :.decrst :dec-private-mode-reset
59  :show-cursor :hide-cursor
60  :use-alternate-screen-buffer :use-normal-screen-buffer
61  ;; common
62  :clear
63  :home
64  ;; stty
65  :set-tty-mode))
66 
67 (defpackage :cli/prompt
68  (:use :cl :std)
69  (:export
70  :completing-read
71  :defprompt))
72 
73 (defpackage :cli/progress
74  (:use :cl :std)
75  (:export
76  :update-progress
77  :with-progress-bar
78  :*progress-bar*
79  :*progress-bar-enabled*
80  :start-progress-display
81  :finish-progress-display
82  :progress-mutex
83  :uncertain-size-progress-bar
84  :progress-bar
85  :with-progress-maybe))
86 
87 (defpackage :cli/spark
88  (:use :cl :std)
89  (:export
90  :spark :*ticks*
91  :vspark :*vticks*))
92 
93 (defpackage :cli/repl
94  (:use :cl :std :cli/progress :cli/spark)
95  (:export :load-acl-repl :start-rl-repl))
96 
97 (defpackage :cli/ed
98  (:use :cl :std :cli/env)
99  (:export :run-emacs :run-emacsclient :org-store-link))