Hi, all Common Lispers.
I have introduced Roswell as a script execution environment in the recent 2 blog posts. Though this blog is not only for Roswell, I'm surprised that there's still to be written about Roswell.
I'm going to write today is the easy way to startup a Common Lisp application with Roswell.
The secret of -s
option
-s
option for ros
command is for loading a library (ASDF system). If it's used with run
subcommand, the system is already loaded in the started REPL:
# Load Dexador and start REPL
$ ros -s dexador run
* (dex:get "https://api.quickdocs.org")
However, the option has a secret feature.
Let's take a look at a real example, http.server:
$ ros install roswell/http.server
$ ros -s http.server
Hunchentoot server is going to start.
Listening on 127.0.0.1:5000.
What's happening here?
The -s
option, which is not followed by any subcommands, Roswell invokes the system's entry point (if it's defined).
The "http.server" entry point starts a static HTTP server for the current directory. http://localhost:5000
serves an index.html if it exists. If not, it shows a list of files/directories.
Note: This idea obviously came from Python's http.server.
The official GitHub repos is here:
ASDF's entry point is used only when building an executable officially; however, Roswell uses it to run a Common Lisp app from command-line instantly.
For instance, if your application named "myapp" has an entry point function, and wants to invoke it, the following command will work.
$ ros -S . -s myapp
-S
(a large S) adds a directory to the ASDF registry path. -S .
is like an idiom to allow ASDF to search systems from the current directory.
This -s
behavior is almost hidden, and I don't know other examples to show you yet. Consider using this when you write a Common Lisp application.