Developer utilities: add Quicksearch

This commit is contained in:
vindarel 2022-01-07 17:41:20 +01:00
parent 6e4b6fca45
commit 82ca7b7ed8
4 changed files with 38 additions and 5 deletions

View file

@ -105,9 +105,11 @@
;;;
;;; User helpers.
;;; ;TODO: we don't want these dependencies when we build a binary.
;;;
:named-readtables
:clesh ;; shell pass-through
:quicksearch ;; search on GitHub, Cliki, Quickdocs.
)
:components ((:module "src"
:components

View file

@ -625,3 +625,31 @@ Learn more with:
(arglist #'foo)
;; (a b c &optional d)
```
### Searching for libraries on GitHub, Quickdocs and Cliki (quicksearch)
We include
[Quicksearch](https://github.com/lisp-maintainers/quicksearch), a
simple search utility for Common Lisp libraries:
(qs:? "ciel" :u)
this will search on GitHub, Quickdocs and Cliki for "ciel", and it
will print the URL of search results.
```
SEARCH-RESULTS: "ciel"
======================
Cliki
-----
cl-cron
http://www.cliki.net/cl-cron
GitHub
------
CIEL
https://github.com/ciel-lang/CIEL
cl-cron
https://github.com/lisp-mirror/cl-cron
```

View file

@ -243,11 +243,11 @@
(t (apply fun (subseq args 0 l))))))
(defun handle-special-input (text)
(let* ((splt (str:words text))
(k (subseq (car splt) 1 (length (car splt))))
(let* ((words (str:words text))
(k (subseq (car words) 1 (length (car words))))
(v (gethash k *special*)))
(if v
(call-special v (car splt) (cdr splt))
(call-special v (car words) (cdr words))
(format *error-output* "Unknown special command: ~a~%" k))))
(defun evaluate-lisp (text parsed)

View file

@ -55,10 +55,13 @@
else if (functionp program) return program))
(defun basename (arg)
(when arg
(namestring (pathname-name arg))))
;; ARG can be any string. This fails with "(qs:?" (note the "?").
(ignore-errors
(when arg
(namestring (pathname-name arg)))))
(defun shell-command-wrapper-p (command)
"Is this command (string) a shell wrapper?"
(find (basename command)
*command-wrappers*
:test #'string-equal))