changeset 80: |
eaf36eb2fc97 |
parent 79: |
24728cba3558 |
child 81: |
a215ed402233 |
author: |
ellis <ellis@rwest.io> |
date: |
Tue, 05 Dec 2023 21:51:58 -0500 |
files: |
.hgsub .hgsubstate lisp/std/cli.lisp lisp/std/fmt.lisp |
description: |
rm infra subrepo |
1.1--- a/.hgsub Mon Dec 04 21:13:35 2023 -0500
1.2+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3@@ -1,1 +0,0 @@
1.4-infra=https://vc.compiler.company/comp/infra
1.5\ No newline at end of file
2.1--- a/.hgsubstate Mon Dec 04 21:13:35 2023 -0500
2.2+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
2.3@@ -1,1 +0,0 @@
2.4-d15e540441fd55dfa7543a6a8e3fb22606769587 infra
3.1--- a/lisp/std/cli.lisp Mon Dec 04 21:13:35 2023 -0500
3.2+++ b/lisp/std/cli.lisp Tue Dec 05 21:51:58 2023 -0500
3.3@@ -35,6 +35,8 @@
3.4 :*cli-opt-kinds*
3.5 :global-opt-p
3.6 :exec-path-list
3.7+ :program-list
3.8+ :find-exe
3.9 :ld-library-path-list
3.10 :argp
3.11 :$val
3.12@@ -113,20 +115,35 @@
3.13
3.14 (in-package :std/cli)
3.15
3.16+(defvar *argv*)
3.17+
3.18 (defun cli-arg0 () (car sb-ext:*posix-argv*))
3.19 (defun cli-args () (cdr sb-ext:*posix-argv*))
3.20
3.21 (declaim (inline exec-path-list))
3.22 (defun exec-path-list ()
3.23+ "Return a list of all members of PATH"
3.24 (let ((var (sb-posix:getenv "PATH")))
3.25 (let ((lst (loop for i = 0 then (1+ j)
3.26- as j = (position #\: var :start i)
3.27- collect (subseq var i j)
3.28- while j)))
3.29+ as j = (position #\: var :start i)
3.30+ when (uiop:directory-exists-p (probe-file (subseq var i j)))
3.31+ collect (probe-file (subseq var i j))
3.32+ while j)))
3.33 (unless (null (car lst))
3.34 (mapcar (lambda (x) (car (directory x)))
3.35 lst)))))
3.36
3.37+(defun program-list ()
3.38+ "Return a fresh list of all files in PATH directories."
3.39+ (loop for p in (exec-path-list)
3.40+ append (uiop:directory-files p)))
3.41+
3.42+(defun find-exe (name &optional programs)
3.43+ "Find NAME in list of PROGRAMS, defaulting to the result of #'program-list."
3.44+ (find name (or programs (program-list))
3.45+ :test #'equalp
3.46+ :key #'pathname-name))
3.47+
3.48 (declaim (inline ld-library-path-list))
3.49 (defun ld-library-path-list ()
3.50 (let ((var (sb-posix:getenv "LD_LIBRARY_PATH")))
3.51@@ -286,8 +303,6 @@
3.52 (progn ,@body ,ret))))))
3.53
3.54 ;;; Utils
3.55-(defvar *argv*)
3.56-
3.57 (defun make-cli (kind &rest slots)
3.58 "Creates a new CLI object of the given kind."
3.59 (declare (type (member :opt :cmd :cli t) kind))
4.1--- a/lisp/std/fmt.lisp Mon Dec 04 21:13:35 2023 -0500
4.2+++ b/lisp/std/fmt.lisp Tue Dec 05 21:51:58 2023 -0500
4.3@@ -1,11 +1,11 @@
4.4 ;;; std/fmt.lisp --- printer and format utils
4.5
4.6 ;;; Code:
4.7-(defpackage :std/fmt
4.8+(uiop:define-package :std/fmt
4.9 (:nicknames :fmt)
4.10 (:use :cl :std/base :std/fu)
4.11- (:import-from :uiop :println)
4.12- (:export :printer-status :fmt-row :fmt-sxhash :iprintln :fmt-tree))
4.13+ (:shadowing-import-from :uiop :println)
4.14+ (:export :printer-status :fmt-row :fmt-sxhash :iprintln :fmt-tree :println))
4.15
4.16 (in-package :std/fmt)
4.17