mirror of
https://gitlab.com/vindarel/ciel.git
synced 2026-01-18 23:31:07 -08:00
scripting: register and call built-in scripts by name
This commit is contained in:
parent
3c371c9a81
commit
0d95880caa
7 changed files with 109 additions and 61 deletions
3
src/scripts/README.md
Normal file
3
src/scripts/README.md
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
|
||||
|
||||
- it is better to use `uiop:*command-line-arguments*` instead of `(uiop:command-line-arguments)`. The latter always get the original full list, but when calling `ciel -s` we need to pop the arguments list, to ditch the `-s`.
|
||||
|
|
@ -10,9 +10,9 @@
|
|||
|
||||
(in-package :ciel-user)
|
||||
|
||||
(unless (second (uiop:command-line-arguments))
|
||||
(unless (second uiop:*command-line-arguments*)
|
||||
(format! t "Quicksearch: search for Lisp libraries on Quicklisp, Cliki and Github.~&")
|
||||
(format! t "Usage: ciel quicksearch.lisp keyword~&")
|
||||
(uiop:quit))
|
||||
|
||||
(quicksearch:? (second (uiop:command-line-arguments)) :ud) ;; url and details.
|
||||
(quicksearch:? (second uiop:*command-line-arguments*) :ud) ;; url and details.
|
||||
|
|
|
|||
|
|
@ -8,12 +8,12 @@
|
|||
(in-package :ciel-user)
|
||||
|
||||
;; CLI args: the script name, an optional port number.
|
||||
(defparameter *port* (or (parse-integer (second (uiop:command-line-arguments)))
|
||||
8000))
|
||||
(defparameter *port* (or (ignore-errors (parse-integer (second uiop:*command-line-arguments*)))
|
||||
9000))
|
||||
|
||||
(defvar *acceptor* (make-instance 'hunchentoot:easy-acceptor
|
||||
:document-root "./"
|
||||
:port *port*))
|
||||
(defparameter *acceptor* (make-instance 'hunchentoot:easy-acceptor
|
||||
:document-root "./"
|
||||
:port *port*))
|
||||
(hunchentoot:start *acceptor*)
|
||||
|
||||
;; Serve static assets under a static/ directory (optional).
|
||||
|
|
@ -26,4 +26,8 @@
|
|||
(handler-case
|
||||
(sleep most-positive-fixnum)
|
||||
(sb-sys:interactive-interrupt ()
|
||||
(format! t "Bye!")))
|
||||
(format! t "Bye!")
|
||||
(hunchentoot:stop *acceptor*))
|
||||
(error ()
|
||||
(format! t "An error occured. Quitting.")
|
||||
(hunchentoot:stop *acceptor*)))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue