From 7f5d864294f17e31617242e7c9b2940204772c13 Mon Sep 17 00:00:00 2001 From: vindarel Date: Mon, 16 Sep 2024 17:26:15 +0200 Subject: [PATCH] change ciel feature to ciel-script --- docs/scripting.md | 12 ++++++------ scripting.lisp | 4 ++-- src/ciel.lisp | 2 +- src/scripts/apipointer.lisp | 4 ++-- src/scripts/finder.lisp | 2 +- src/scripts/quicksearch.lisp | 2 +- src/scripts/simpleHTTPserver.lisp | 2 +- src/scripts/webapp-notify.lisp | 2 +- src/scripts/webapp.lisp | 2 +- 9 files changed, 16 insertions(+), 16 deletions(-) diff --git a/docs/scripting.md b/docs/scripting.md index b17d7e0..ce3c4d0 100644 --- a/docs/scripting.md +++ b/docs/scripting.md @@ -189,7 +189,7 @@ Finally, we write a handler function, that reads the arguments and does somethin Now, run everything: ~~~lisp -#+ciel +#+ciel-script (clingon:run *cli/command* *script-args*) ~~~ @@ -277,7 +277,7 @@ How it works: ## Main function and interactive development -TLDR: use the `#+ciel` feature flag as in: +TLDR: use the `#+ciel-script` feature flag as in: ~~~lisp (in-package :ciel-user) @@ -285,7 +285,7 @@ TLDR: use the `#+ciel` feature flag as in: (defun main () …) -#+ciel +#+ciel-script (main) ~~~ @@ -320,7 +320,7 @@ list. The `#+foo` reader macro is the way to check if the feature always disable a piece of code, the pattern is `#+(or)`, that always evaluates to nil. -Make sure you are "in" the `ciel-user` package when writing this `#+ciel` check. +Make sure you are "in" the `ciel-user` package when writing this `#+ciel-script` check. ## Eval and one-liners @@ -496,7 +496,7 @@ This creates one route on `/` with an optional `name` parameter. Go to `localhos (defun stop-webapp () (hunchentoot:stop *server*)) -#+ciel +#+ciel-script (progn (start-webapp) (format t "~&App started on localhost:4567…~&") @@ -533,7 +533,7 @@ This allows you to have a dumb "live reload" workflow with a simple editor and a ;; Catch some READ errors, such as parenthesis not closed, etc. (format! t "~%~%read error, waiting for change…~&")))))) -#+ciel +#+ciel-script (unless *server* (start-webapp) (format t "~&App started on localhost:4567…~&") diff --git a/scripting.lisp b/scripting.lisp index 792695b..3476a25 100644 --- a/scripting.lisp +++ b/scripting.lisp @@ -48,7 +48,7 @@ (t ;; Run it! ;; We first add a symbol in the feature list, so a script nows when it is being executed. - (push :ciel ciel-user::*features*) + (push :ciel-script ciel-user::*features*) ;; We ignore the shebang line, if there is one. ;; We can call scripts either with ciel -s or with ./script (load (maybe-ignore-shebang @@ -226,7 +226,7 @@ ((and (first args) (uiop:file-exists-p (first args))) ;; Add a symbol in the feature list, so a script knows when it is being executed. - (push :ciel ciel-user::*features*) + (push :ciel-script ciel-user::*features*) ;; The remaining free args are passed along to our script's arguments. ;; Here the file name is already a free arg, so args equals something like diff --git a/src/ciel.lisp b/src/ciel.lisp index 1c6bb26..38052a1 100644 --- a/src/ciel.lisp +++ b/src/ciel.lisp @@ -397,7 +397,7 @@ We currently only try this with serapeum. See *deps/serapeum/sequences-hashtable (defparameter *current-pprint-indentation* 1 "We use custom indentation instead of the pretty printer, because it doesn't print correctly in the shell (indentations are way too large).") -;; TEST +;TEST (defun pretty-print-hash-table (ht &optional (stream *standard-output*)) "Pretty print hash-table HT to STREAM. diff --git a/src/scripts/apipointer.lisp b/src/scripts/apipointer.lisp index e1f5891..9ceec00 100755 --- a/src/scripts/apipointer.lisp +++ b/src/scripts/apipointer.lisp @@ -35,7 +35,7 @@ ;; Feature flag: ;; call our main function only when running the script, not when developing on the REPL. -#+ciel +#+ciel-script (main (second uiop:*command-line-arguments*) (third uiop:*command-line-arguments*)) -#-ciel +#-ciel-script (format t "Usage: (main url pointer)~&") diff --git a/src/scripts/finder.lisp b/src/scripts/finder.lisp index 074153d..022d303 100644 --- a/src/scripts/finder.lisp +++ b/src/scripts/finder.lisp @@ -37,5 +37,5 @@ list) (terpri)) -#+ciel +#+ciel-script (pprint-for-shell (find-files (rest *script-args*))) diff --git a/src/scripts/quicksearch.lisp b/src/scripts/quicksearch.lisp index 532d814..5b9d927 100755 --- a/src/scripts/quicksearch.lisp +++ b/src/scripts/quicksearch.lisp @@ -18,5 +18,5 @@ ;; We use a "feature flag" kind of like a "file == __main__" check: ;; don't run this when developing on the REPL, but yes run it when calling it with CIEL. -#+ciel +#+ciel-script (quicksearch:? (second uiop:*command-line-arguments*) :ud) ;; url and details. diff --git a/src/scripts/simpleHTTPserver.lisp b/src/scripts/simpleHTTPserver.lisp index a4abb01..130dbd3 100755 --- a/src/scripts/simpleHTTPserver.lisp +++ b/src/scripts/simpleHTTPserver.lisp @@ -209,5 +209,5 @@ the script name. ;; Call the main function only when running this as a script, ;; not when developing on the REPL. -#+ciel +#+ciel-script (clingon:run (cli/command) *script-args*) diff --git a/src/scripts/webapp-notify.lisp b/src/scripts/webapp-notify.lisp index ab5bb3d..db71c60 100755 --- a/src/scripts/webapp-notify.lisp +++ b/src/scripts/webapp-notify.lisp @@ -48,7 +48,7 @@ (format! t "~%~%read error, waiting for change…~&")))))) -#+ciel +#+ciel-script (unless *server* (start-webapp) (format t "~&App started on localhost:4567…~&") diff --git a/src/scripts/webapp.lisp b/src/scripts/webapp.lisp index e34b1a0..f1b8d64 100755 --- a/src/scripts/webapp.lisp +++ b/src/scripts/webapp.lisp @@ -18,7 +18,7 @@ (defun stop-webapp () (hunchentoot:stop *server*)) -#+ciel +#+ciel-script (progn (start-webapp) (format t "~&App started on localhost:4567…~&")