1
0
Fork 0

- added code to allow scripts to gets their command line switches

those switches (if any) after the "--" are returned by function "script-arguments"
  and can be used by scripts.
This commit is contained in:
cage 2024-08-26 20:56:29 +02:00
parent 51cc86cf42
commit 6012150f33
2 changed files with 11 additions and 1 deletions

View File

@ -141,6 +141,9 @@
(defparameter *fediverse-account* nil)
(defparameter *free-arguments* nil)
(defun exit-on-error (e)
(format *error-output* "~a~%" e)
(os-utils:exit-program 1))
@ -194,12 +197,17 @@
(values (elt splitted 0)
(elt splitted 1))))
(defun script-arguments ()
*free-arguments*)
(defun manage-opts ()
(handler-bind ((opts:unknown-option #'exit-on-error)
(opts:missing-arg #'exit-on-error)
(opts:missing-required-option #'exit-on-error))
(gen-opts)
(let ((options (opts:get-opts)))
(multiple-value-bind (options free-arguments)
(opts:get-opts)
(setf *free-arguments* free-arguments)
(when (getf options :bash-complete)
(complete)
(os-utils:exit-program))

View File

@ -1594,6 +1594,7 @@
(:shadowing-import-from :misc :random-elt :shuffle)
(:export
:+start-server-command-line+
:*free-arguments*
:*start-folder*
:*start-timeline*
:*update-timeline*
@ -1610,6 +1611,7 @@
:*rpc-server-mode*
:*rpc-client-mode*
:fediverse-account-parameters
:script-arguments
:manage-opts))
(defpackage :specials