-;;; Command entering
-;;
-
-(defun lurk-enter-string (string)
- (if (string-prefix-p "/" string)
- (pcase string
- ((rx (: "/" (let cmd-str (+ (not whitespace)))
- (opt (+ whitespace)
- (let params-str (+ anychar))
- string-end)))
- (let ((command-row (assoc (upcase cmd-str) lurk-command-table #'equal))
- (params (if params-str
- (split-string params-str nil t)
- nil)))
- (if command-row
- (funcall (elt command-row 2) params)
- (lurk-send-msg (lurk-msg nil nil (upcase cmd-str) params)))))
- (_
- (lurk-display-error "Badly formed command.")))
- (unless (string-empty-p string)
- (if lurk-current-context
- (progn
- (lurk-send-msg (lurk-msg nil nil "PRIVMSG"
- lurk-current-context
- string))
- (lurk-display-message lurk-nick lurk-current-context string))
- (lurk-display-error "No current context.")))))
+(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.")))