ciel/src/scripts
vindarel a92914cfd0 scripting: Clingon trick to pass unknown options to the script without "--"
a caveat: it does not catch legitimate unknown options given before
the script name,
and it catches known options given after it, though we would like not
to.

$ ./script.lisp -v

-v is caught for CIEL.

$ ./script.lisp -- -v

-v is passed to script.

$ ciel -x -s script

-x is not caught as unknown for CIEL but passed along to script.

$ ciel -v -x -s script

the -v at first position allows to see that -x is passed along.

$ ./script.lisp -x 4242

for other cases, we don't need a "--" and that's pretty cool.

Damn, was it worth spending a day on it?
2023-04-19 15:23:43 +02:00
..
apipointer.lisp scripting: isolate a main function with #+ciel 2023-04-18 09:26:19 +02:00
quicksearch.lisp scripting: isolate a main function with #+ciel 2023-04-18 09:26:19 +02:00
README.md scripting: register and call built-in scripts by name 2022-12-28 15:11:46 +01:00
simpleHTTPserver.lisp scripting: Clingon trick to pass unknown options to the script without "--" 2023-04-19 15:23:43 +02:00

  • 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.