Merge branch '2935-compatibility-issue-with-cat-piping' of github.com:domenicomastrangelo/bat into 2935-compatibility-issue-with-cat-piping

This commit is contained in:
Domenico Mastrangelo 2024-06-01 22:49:50 +02:00
commit 9523e40179
5 changed files with 2442 additions and 76 deletions

View File

@ -38,6 +38,7 @@
- Display which theme is the default one in basic output (no colors), see #2937 (@sblondon) - Display which theme is the default one in basic output (no colors), see #2937 (@sblondon)
- Display which theme is the default one in colored output, see #2838 (@sblondon) - Display which theme is the default one in colored output, see #2838 (@sblondon)
- Add aarch64-apple-darwin ("Apple Silicon") binary tarballs to releases, see #2967 (@someposer) - Add aarch64-apple-darwin ("Apple Silicon") binary tarballs to releases, see #2967 (@someposer)
- Update the Lisp syntax, see #2970 (@ccqpein)
## Syntaxes ## Syntaxes

24
Cargo.lock generated
View File

@ -489,9 +489,9 @@ checksum = "6999dc1837253364c2ebb0704ba97994bd874e8f195d665c50b7548f6ea92764"
[[package]] [[package]]
name = "flate2" name = "flate2"
version = "1.0.28" version = "1.0.30"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "46303f565772937ffe1d394a4fac6f411c6013172fadde9dcdb1e147a086940e" checksum = "5f54427cfd1c7829e2a139fcefea601bf088ebca651d2bf53ebc600eac295dae"
dependencies = [ dependencies = [
"crc32fast", "crc32fast",
"miniz_oxide", "miniz_oxide",
@ -564,9 +564,9 @@ dependencies = [
[[package]] [[package]]
name = "git2" name = "git2"
version = "0.18.2" version = "0.18.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b3ba52851e73b46a4c3df1d89343741112003f0f6f13beb0dfac9e457c3fdcd" checksum = "232e6a7bfe35766bf715e55a88b39a700596c0ccfd88cd3680b4cdb40d66ef70"
dependencies = [ dependencies = [
"bitflags 2.4.0", "bitflags 2.4.0",
"libc", "libc",
@ -658,9 +658,9 @@ dependencies = [
[[package]] [[package]]
name = "itertools" name = "itertools"
version = "0.12.1" version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186"
dependencies = [ dependencies = [
"either", "either",
] ]
@ -1110,9 +1110,9 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
[[package]] [[package]]
name = "semver" name = "semver"
version = "1.0.21" version = "1.0.23"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b97ed7a9823b74f99c7742f5336af7be5ecd3eeafcb1507d1fa93347b1d589b0" checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b"
[[package]] [[package]]
name = "serde" name = "serde"
@ -1327,18 +1327,18 @@ checksum = "507e9898683b6c43a9aa55b64259b721b52ba226e0f3779137e50ad114a4c90b"
[[package]] [[package]]
name = "thiserror" name = "thiserror"
version = "1.0.53" version = "1.0.61"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b2cd5904763bad08ad5513ddbb12cf2ae273ca53fa9f68e843e236ec6dfccc09" checksum = "c546c80d6be4bc6a00c0f01730c08df82eaa7a7a61f11d656526506112cc1709"
dependencies = [ dependencies = [
"thiserror-impl", "thiserror-impl",
] ]
[[package]] [[package]]
name = "thiserror-impl" name = "thiserror-impl"
version = "1.0.53" version = "1.0.61"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3dcf4a824cce0aeacd6f38ae6f24234c8e80d68632338ebaa1443b5df9e29e19" checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",

View File

@ -103,7 +103,7 @@ nix = { version = "0.26.4", default-features = false, features = ["term"] }
[build-dependencies] [build-dependencies]
anyhow = "1.0.78" anyhow = "1.0.78"
indexmap = { version = "2.2.6", features = ["serde"] } indexmap = { version = "2.2.6", features = ["serde"] }
itertools = "0.12.1" itertools = "0.13.0"
once_cell = "1.18" once_cell = "1.18"
regex = "1.10.2" regex = "1.10.2"
serde = "1.0" serde = "1.0"

2365
assets/patches/Lisp.sublime-syntax.patch vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -1,80 +1,80 @@
(cl:defpackage :chillax.utils (cl:defpackage :chillax.utils
 (:use :cl :alexandria)  (:use :cl :alexandria)
 (:export  (:export
 :fun :mkhash :hashget :strcat :dequote :at))  :fun :mkhash :hashget :strcat :dequote :at))
(in-package :chillax.utils) (in-package :chillax.utils)
;;; Functions ;;; Functions
(defmacro fun (&body body) (defmacro fun (&body body)
 "This macro puts the FUN back in FUNCTION."  "This macro puts the FUN back in FUNCTION."
 `(lambda (&optional _) (declare (ignorable _)) ,@body))  `(lambda (&optional _) (declare (ignorable _)) ,@body))
;;; Hash tables ;;; Hash tables
(defun mkhash (&rest keys-and-values &aux (table (make-hash-table :test #'equal))) (defun mkhash (&rest keys-and-values &aux (table (make-hash-table :test #'equal)))
 "Convenience function for `literal' hash table definition."  "Convenience function for `literal' hash table definition."
 (loop for (key val) on keys-and-values by #'cddr do (setf (gethash key table) val)  (loop for (key val) on keys-and-values by #'cddr do (setf (gethash key table) val)
 finally (return table)))  finally (return table)))
(defun hashget (hash &rest keys) (defun hashget (hash &rest keys)
 "Convenience function for recursively accessing hash tables."  "Convenience function for recursively accessing hash tables."
 (reduce (lambda (h k) (gethash k h)) keys :initial-value hash))  (reduce (lambda (h k) (gethash k h)) keys :initial-value hash))
(define-compiler-macro hashget (hash &rest keys) (define-compiler-macro hashget (hash &rest keys)
 (if (null keys) hash  (if (null keys) hash
 (let ((hash-sym (make-symbol "HASH"))  (let ((hash-sym (make-symbol "HASH"))
 (key-syms (loop for i below (length keys)  (key-syms (loop for i below (length keys)
 collect (make-symbol (format nil "~:@(~:R~)-KEY" i)))))  collect (make-symbol (format nil "~:@(~:R~)-KEY" i)))))
 `(let ((,hash-sym ,hash)  `(let ((,hash-sym ,hash)
 ,@(loop for key in keys for sym in key-syms  ,@(loop for key in keys for sym in key-syms
 collect `(,sym ,key)))  collect `(,sym ,key)))
 ,(reduce (lambda (hash key) `(gethash ,key ,hash))  ,(reduce (lambda (hash key) `(gethash ,key ,hash))
 key-syms :initial-value hash-sym)))))  key-syms :initial-value hash-sym)))))
(defun (setf hashget) (new-value hash key &rest more-keys) (defun (setf hashget) (new-value hash key &rest more-keys)
 "Uses the last key given to hashget to insert NEW-VALUE into the hash table  "Uses the last key given to hashget to insert NEW-VALUE into the hash table
returned by the second-to-last key. returned by the second-to-last key.
tl;dr: DWIM SETF function for HASHGET." tl;dr: DWIM SETF function for HASHGET."
 (if more-keys  (if more-keys
 (setf (gethash (car (last more-keys))  (setf (gethash (car (last more-keys))
 (apply #'hashget hash key (butlast more-keys)))  (apply #'hashget hash key (butlast more-keys)))
 new-value)  new-value)
 (setf (gethash key hash) new-value)))  (setf (gethash key hash) new-value)))
;;; Strings ;;; Strings
(defun strcat (string &rest more-strings) (defun strcat (string &rest more-strings)
 (apply #'concatenate 'string string more-strings))  (apply #'concatenate 'string string more-strings))
(defun dequote (string) (defun dequote (string)
 (let ((len (length string)))  (let ((len (length string)))
 (if (and (> len 1) (starts-with #\" string) (ends-with #\" string))  (if (and (> len 1) (starts-with #\" string) (ends-with #\" string))
 (subseq string 1 (- len 1))  (subseq string 1 (- len 1))
 string)))  string)))
;;; ;;;
;;; At ;;; At
;;; ;;;
(defgeneric at (doc &rest keys)) (defgeneric at (doc &rest keys))
(defgeneric (setf at) (new-value doc key &rest more-keys)) (defgeneric (setf at) (new-value doc key &rest more-keys))
(defmethod at ((doc hash-table) &rest keys) (defmethod at ((doc hash-table) &rest keys)
 (apply #'hashget doc keys))  (apply #'hashget doc keys))
(defmethod (setf at) (new-value (doc hash-table) key &rest more-keys) (defmethod (setf at) (new-value (doc hash-table) key &rest more-keys)
 (apply #'(setf hashget) new-value doc key more-keys))  (apply #'(setf hashget) new-value doc key more-keys))
(defmethod at ((doc list) &rest keys) (defmethod at ((doc list) &rest keys)
 (reduce (lambda (alist key)  (reduce (lambda (alist key)
 (cdr (assoc key alist :test #'equal)))  (cdr (assoc key alist :test #'equal)))
 keys :initial-value doc))  keys :initial-value doc))
(defmethod (setf at) (new-value (doc list) key &rest more-keys) (defmethod (setf at) (new-value (doc list) key &rest more-keys)
 (if more-keys  (if more-keys
 (setf (cdr (assoc (car (last more-keys))  (setf (cdr (assoc (car (last more-keys))
 (apply #'at doc key (butlast more-keys))  (apply #'at doc key (butlast more-keys))
 :test #'equal))  :test #'equal))
 new-value)  new-value)
 (setf (cdr (assoc key doc :test #'equal)) new-value)))  (setf (cdr (assoc key doc :test #'equal)) new-value)))
;; A playful alias. ;; A playful alias.
(defun @ (doc &rest keys) (defun @ (doc &rest keys)
 (apply #'at doc keys))  (apply #'at doc keys))
(defun (setf @) (new-value doc key &rest more-keys) (defun (setf @) (new-value doc key &rest more-keys)
 (apply #'(setf at) new-value doc key more-keys))  (apply #'(setf at) new-value doc key more-keys))