From 0d70a53705ca8bd1f01d49361754409ccef4d428 Mon Sep 17 00:00:00 2001 From: plugd Date: Thu, 15 Jul 2021 10:11:30 +0200 Subject: [PATCH] Added help system. --- lurk.el | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/lurk.el b/lurk.el index 68fff0d..42f4cdb 100644 --- a/lurk.el +++ b/lurk.el @@ -831,7 +831,8 @@ in which case they match anything.") ("QUIT" "Disconnect from current network." lurk-command-quit) ("NICK" "Change nick." lurk-command-nick) ("LIST" "Display details of one or more channels." lurk-command-list) - ("MSG" "Send private message to user." lurk-command-msg lurk-nick-completions)) + ("MSG" "Send private message to user." lurk-command-msg lurk-nick-completions) + ("HELP" "Display help on client commands." lurk-command-help lurk-help-completions)) "Table of commands explicitly supported by Lurk.") (defun lurk-boolean-completions () @@ -846,6 +847,22 @@ in which case they match anything.") (defun lurk-context-completions () (lurk-get-context-list)) +(defun lurk-help-completions () + (mapcar (lambda (row) (car row)) lurk-command-table)) + +(defun lurk-command-help (params) + (if params + (let* ((cmd-str (upcase (car params))) + (row (assoc cmd-str lurk-command-table #'equal))) + (if row + (progn + (lurk-display-notice nil "Help for \x02" cmd-str "\x02:") + (lurk-display-notice nil " " (elt row 1))) + (lurk-display-notice nil "No such (client-interpreted) command."))) + (lurk-display-notice nil "Client-interpreted commands:") + (dolist (row lurk-command-table) + (lurk-display-notice nil " \x02" (elt row 0) "\x02: " (elt row 1))) + (lurk-display-notice nil "Use /HELP COMMAND to display information about a specific command."))) ;;; Command entering ;; -- 2.20.1