Fix code indentation
This commit is contained in:
parent
952a1acc58
commit
fb794d0362
1 changed files with 25 additions and 25 deletions
|
@ -34,7 +34,7 @@ Takes DIRNAME as an argument and prints its description."
|
|||
(let ((description (assoc-default dirname linux-filesystem-alist)))
|
||||
(if description
|
||||
(message "%s: %s" dirname description)
|
||||
(message "Unknown directory: %s" dirname))))
|
||||
(message "Unknown directory: %s" dirname))))
|
||||
|
||||
(defvar bash-regex-alist
|
||||
'(("empty line" . "^$")
|
||||
|
@ -62,7 +62,7 @@ Takes REGEX as an argument and prints its description."
|
|||
(let ((description (assoc-default regex bash-regex-alist)))
|
||||
(if description
|
||||
(message "%s: %s" regex description)
|
||||
(message "Unknown regular expression: %s" regex))))
|
||||
(message "Unknown regular expression: %s" regex))))
|
||||
|
||||
(defvar linux-process-commands-alist
|
||||
'(("ps" . "Shows a snapshot of the current processes")
|
||||
|
@ -84,7 +84,7 @@ Takes COMMAND as an argument and prints its description."
|
|||
(let ((description (assoc-default command linux-process-commands-alist)))
|
||||
(if description
|
||||
(message "%s: %s" command description)
|
||||
(message "Unknown command: %s" command))))
|
||||
(message "Unknown command: %s" command))))
|
||||
|
||||
(defvar linux-logfiles-alist
|
||||
'(("/var/log/syslog" . "System messages, including the messages that are logged during system startup")
|
||||
|
@ -106,7 +106,7 @@ Takes LOGFILE as an argument and prints its description."
|
|||
(let ((description (assoc-default logfile linux-logfiles-alist)))
|
||||
(if description
|
||||
(message "%s: %s" logfile description)
|
||||
(message "Unknown log file: %s" logfile))))
|
||||
(message "Unknown log file: %s" logfile))))
|
||||
|
||||
(defvar linux-basic-commands-alist
|
||||
'(("list directory contents" . "ls")
|
||||
|
@ -128,7 +128,7 @@ Takes COMMAND as an argument and prints its description."
|
|||
(let ((description (assoc-default command linux-basic-commands-alist)))
|
||||
(if description
|
||||
(message "%s: %s" command description)
|
||||
(message "Unknown command: %s" command))))
|
||||
(message "Unknown command: %s" command))))
|
||||
|
||||
(defvar chown-options-alist
|
||||
'(("-R" . "Operate on files and directories recursively")
|
||||
|
@ -148,7 +148,7 @@ Takes OPTION as an argument and prints its description."
|
|||
(let ((description (assoc-default option chown-options-alist)))
|
||||
(if description
|
||||
(message "%s: %s" option description)
|
||||
(message "Unknown chown option: %s" option))))
|
||||
(message "Unknown chown option: %s" option))))
|
||||
|
||||
(defvar chmod-options-alist
|
||||
'(("-R" . "Operate on files and directories recursively")
|
||||
|
@ -170,7 +170,7 @@ Takes OPTION as an argument and prints its description."
|
|||
(let ((description (assoc-default option chmod-options-alist)))
|
||||
(if description
|
||||
(message "%s: %s" option description)
|
||||
(message "Unknown chmod option: %s" option))))
|
||||
(message "Unknown chmod option: %s" option))))
|
||||
|
||||
(defvar ssh-use-cases-alist
|
||||
'(("remote login" . "ssh user@host")
|
||||
|
@ -191,7 +191,7 @@ Takes OPTION as an argument and prints its description."
|
|||
(let ((command (assoc-default use-case ssh-use-cases-alist)))
|
||||
(if command
|
||||
(message "Command for %s: %s" use-case command)
|
||||
(message "Use case not found"))))
|
||||
(message "Use case not found"))))
|
||||
|
||||
(defvar mk/remote-*host-aliases*
|
||||
'(("website" . "marcus@u1.marcuskammer.dev")
|
||||
|
@ -217,11 +217,11 @@ COMMAND is the systemctl command to execute on the service (e.g.,
|
|||
(buffer (generate-new-buffer (format "*%s-%s-%s*" alias service command)))
|
||||
(process-name (format "systemctl-%s-%s" command service)))
|
||||
(make-process :name process-name
|
||||
:buffer buffer
|
||||
:command `("ssh" ,host "sudo" "systemctl" ,command ,service)
|
||||
:sentinel (lambda (process signal)
|
||||
(when (memq (process-status process) '(exit signal))
|
||||
(message "Process: %s %s" process signal))))))
|
||||
:buffer buffer
|
||||
:command `("ssh" ,host "sudo" "systemctl" ,command ,service)
|
||||
:sentinel (lambda (process signal)
|
||||
(when (memq (process-status process) '(exit signal))
|
||||
(message "Process: %s %s" process signal))))))
|
||||
|
||||
(defmacro mk/remote-define-systemctl-functions (&rest actions)
|
||||
"Dynamically create functions to interact with systemd services on a remote host.
|
||||
|
@ -242,23 +242,23 @@ an ALIAS and SERVICE as arguments and call
|
|||
|
||||
(defun mk/remote--log (alias service filename)
|
||||
(let* ((filepath (concat "/var/log/" service (unless (string-empty-p filename) (concat "/" filename))))
|
||||
(host (mk/remote--get-real-host alias))
|
||||
(buffer (generate-new-buffer (format "*%s-%s-%s*" alias service filename)))
|
||||
(process-name (format "log-%s-%s" service filename)))
|
||||
(host (mk/remote--get-real-host alias))
|
||||
(buffer (generate-new-buffer (format "*%s-%s-%s*" alias service filename)))
|
||||
(process-name (format "log-%s-%s" service filename)))
|
||||
(make-process :name process-name
|
||||
:buffer buffer
|
||||
:command `("ssh" ,host "sudo" "tail -f" ,filepath)
|
||||
:sentinel (lambda (process signal)
|
||||
(when (memq (process-status process) '(exit signal))
|
||||
(message "Process: %s %s" process signal))))))
|
||||
:buffer buffer
|
||||
:command `("ssh" ,host "sudo" "tail -f" ,filepath)
|
||||
:sentinel (lambda (process signal)
|
||||
(when (memq (process-status process) '(exit signal))
|
||||
(message "Process: %s %s" process signal))))))
|
||||
|
||||
(defmacro mk/define-remote-log-function (alias service &optional filename)
|
||||
"Define a function to asynchronously tail a remote log file."
|
||||
(let ((fname (if filename filename "")))
|
||||
`(defun ,(intern (format "mk/remote-log-%s-%s-%s" alias service filename)) ()
|
||||
,(format "Tail the remote log file: %s" filename)
|
||||
(interactive)
|
||||
(mk/remote--log ,alias ,service ,fname))))
|
||||
`(defun ,(intern (format "mk/remote-log-%s-%s-%s" alias service filename)) ()
|
||||
,(format "Tail the remote log file: %s" filename)
|
||||
(interactive)
|
||||
(mk/remote--log ,alias ,service ,fname))))
|
||||
|
||||
(mk/define-remote-log-function "website" "nginx" "access.csv")
|
||||
(mk/define-remote-log-function "website" "nginx" "error.log")
|
||||
|
|
Loading…
Add table
Reference in a new issue