mirror of https://codeberg.org/cage/tinmop/
- wrapped sb-ext:run-program;
- do not load configuration files if cli options '-h' or '-v' are used.
This commit is contained in:
parent
570cad0394
commit
5f8c20ce7d
|
@ -114,11 +114,13 @@ etc.) happened"
|
||||||
(invoke-restart 'res:create-empty-in-home))))
|
(invoke-restart 'res:create-empty-in-home))))
|
||||||
(swconf:load-config-file swconf:+conf-filename+)))
|
(swconf:load-config-file swconf:+conf-filename+)))
|
||||||
|
|
||||||
|
(defun shared-init ()
|
||||||
|
(load-configuration-files)
|
||||||
|
(init-db))
|
||||||
|
|
||||||
(defun init ()
|
(defun init ()
|
||||||
"Initialize the program"
|
"Initialize the program"
|
||||||
;; (res:init)
|
(shared-init)
|
||||||
;; (load-configuration-files)
|
|
||||||
;; (init-db)
|
|
||||||
(db-utils:with-ready-database (:connect nil)
|
(db-utils:with-ready-database (:connect nil)
|
||||||
(complete:initialize-complete-username-cache)
|
(complete:initialize-complete-username-cache)
|
||||||
(handler-case
|
(handler-case
|
||||||
|
@ -182,7 +184,7 @@ etc.) happened"
|
||||||
(defun load-script-file ()
|
(defun load-script-file ()
|
||||||
"Load (execute) a lisp file used in requests of a command line switch"
|
"Load (execute) a lisp file used in requests of a command line switch"
|
||||||
(setf program-events:*process-events-immediately* t)
|
(setf program-events:*process-events-immediately* t)
|
||||||
(init-db)
|
(shared-init)
|
||||||
(db-utils:with-ready-database (:connect nil)
|
(db-utils:with-ready-database (:connect nil)
|
||||||
(client:init)
|
(client:init)
|
||||||
(client:authorize)
|
(client:authorize)
|
||||||
|
@ -192,8 +194,6 @@ etc.) happened"
|
||||||
"The entry point function of the program"
|
"The entry point function of the program"
|
||||||
(init-i18n)
|
(init-i18n)
|
||||||
(res:init)
|
(res:init)
|
||||||
(load-configuration-files)
|
|
||||||
(init-db)
|
|
||||||
(command-line:manage-opts)
|
(command-line:manage-opts)
|
||||||
(if command-line:*script-file*
|
(if command-line:*script-file*
|
||||||
(load-script-file)
|
(load-script-file)
|
||||||
|
|
|
@ -73,20 +73,37 @@
|
||||||
(values exe args))
|
(values exe args))
|
||||||
(values editor nil))))))
|
(values editor nil))))))
|
||||||
|
|
||||||
|
(defun run-external-program (program args
|
||||||
|
&key
|
||||||
|
(wait t)
|
||||||
|
search
|
||||||
|
#-win32 pty
|
||||||
|
input
|
||||||
|
output
|
||||||
|
(error :output))
|
||||||
|
(sb-ext:run-program program
|
||||||
|
args
|
||||||
|
:wait wait
|
||||||
|
:search search
|
||||||
|
:pty pty
|
||||||
|
:input input
|
||||||
|
:output output
|
||||||
|
:error error))
|
||||||
|
|
||||||
(defun open-with-editor (file)
|
(defun open-with-editor (file)
|
||||||
(multiple-value-bind (exe args)
|
(multiple-value-bind (exe args)
|
||||||
(external-editor)
|
(external-editor)
|
||||||
(let ((actual-args (if args
|
(let ((actual-args (if args
|
||||||
(text-utils:split-words args)
|
(text-utils:split-words args)
|
||||||
nil)))
|
nil)))
|
||||||
(sb-ext:run-program exe
|
(run-external-program exe
|
||||||
(append actual-args
|
(append actual-args
|
||||||
(list file))
|
(list file))
|
||||||
:search t
|
:search t
|
||||||
:wait t
|
:wait t
|
||||||
:input t
|
:input t
|
||||||
:output t
|
:output t
|
||||||
:error t))))
|
:error t))))
|
||||||
|
|
||||||
(defun exit-program (&optional (exit-code 0))
|
(defun exit-program (&optional (exit-code 0))
|
||||||
(uiop:quit exit-code))
|
(uiop:quit exit-code))
|
||||||
|
@ -106,35 +123,35 @@
|
||||||
"-keyout ~a -outform PEM -out ~a")
|
"-keyout ~a -outform PEM -out ~a")
|
||||||
key-file
|
key-file
|
||||||
cert-file)))
|
cert-file)))
|
||||||
(sb-ext:run-program +openssl-bin+
|
(run-external-program +openssl-bin+
|
||||||
(text-utils:split-words cmd-args)
|
(text-utils:split-words cmd-args)
|
||||||
:output nil
|
:output nil
|
||||||
:error :output)
|
:error :output)
|
||||||
(values cert-file key-file)))
|
(values cert-file key-file)))
|
||||||
|
|
||||||
(defun send-to-pipe (data program-and-args)
|
(defun send-to-pipe (data program-and-args)
|
||||||
(croatoan:end-screen)
|
(croatoan:end-screen)
|
||||||
(with-input-from-string (stream data)
|
(with-input-from-string (stream data)
|
||||||
(let ((command-line-splitted (text-utils:split-words program-and-args)))
|
(let ((command-line-splitted (text-utils:split-words program-and-args)))
|
||||||
(sb-ext:run-program (first command-line-splitted)
|
(run-external-program (first command-line-splitted)
|
||||||
(rest command-line-splitted)
|
(rest command-line-splitted)
|
||||||
:search t
|
:search t
|
||||||
:wait t
|
:wait t
|
||||||
:input stream
|
:input stream
|
||||||
:output t
|
:output t
|
||||||
:error t))))
|
:error t))))
|
||||||
|
|
||||||
(defun open-link-with-program (program-and-args link)
|
(defun open-link-with-program (program-and-args link)
|
||||||
(let* ((command-line-splitted (text-utils:split-words program-and-args))
|
(let* ((command-line-splitted (text-utils:split-words program-and-args))
|
||||||
(program (first command-line-splitted))
|
(program (first command-line-splitted))
|
||||||
(args (append (rest command-line-splitted)
|
(args (append (rest command-line-splitted)
|
||||||
(list link))))
|
(list link))))
|
||||||
(sb-ext:run-program program
|
(run-external-program program
|
||||||
args
|
args
|
||||||
:search t
|
:search t
|
||||||
:wait nil
|
:wait nil
|
||||||
:output nil
|
:output nil
|
||||||
:error :output)))
|
:error :output)))
|
||||||
|
|
||||||
(defun open-resource-with-external-program (resource give-focus-to-message-window)
|
(defun open-resource-with-external-program (resource give-focus-to-message-window)
|
||||||
(let ((program (swconf:link-regex->program-to-use resource)))
|
(let ((program (swconf:link-regex->program-to-use resource)))
|
||||||
|
|
Loading…
Reference in New Issue