refactor(cli): remove unused synopsis examples
These can be included in their own EXAMPLES: section, and doesn't need to be treated especially.
This commit is contained in:
parent
a79b2ec69e
commit
f8fb8b189d
1 changed files with 17 additions and 24 deletions
|
@ -265,35 +265,28 @@ OPTIONS:
|
||||||
(options ,@opts)
|
(options ,@opts)
|
||||||
(required ,@(mapcar (fn! (upcase (format "`%s'" %))) (if subcommands? '(command) (alist-get '&required args))))
|
(required ,@(mapcar (fn! (upcase (format "`%s'" %))) (if subcommands? '(command) (alist-get '&required args))))
|
||||||
(optional ,@(mapcar (fn! (upcase (format "[`%s']" %)))(alist-get '&optional args)))
|
(optional ,@(mapcar (fn! (upcase (format "[`%s']" %)))(alist-get '&optional args)))
|
||||||
(rest ,@(mapcar (fn! (upcase (format "[`%s'...]" %))) (if subcommands? '(args) (alist-get '&args args))))
|
(rest ,@(mapcar (fn! (upcase (format "[`%s'...]" %))) (if subcommands? '(args) (alist-get '&args args)))))))
|
||||||
(examples ,@(doom-cli-help--parse-docs (doom-cli-find cli t) "SYNOPSIS")))))
|
|
||||||
|
|
||||||
(defun doom-cli-help--render-synopsis (synopsis &optional prefix with-examples?)
|
(defun doom-cli-help--render-synopsis (synopsis &optional prefix)
|
||||||
(let-alist synopsis
|
(let-alist synopsis
|
||||||
(let ((doom-print-indent 0)
|
(let ((doom-print-indent 0)
|
||||||
(prefix (or prefix ""))
|
(prefix (or prefix ""))
|
||||||
(command (doom-cli-command-string .command)))
|
(command (doom-cli-command-string .command)))
|
||||||
(with-temp-buffer
|
(string-trim-right
|
||||||
(insert! ("%s\n\n"
|
(format! "%s\n\n"
|
||||||
(fill (concat prefix
|
(fill (concat (bold prefix)
|
||||||
(bold (format "%s " command))
|
(format "%s " command)
|
||||||
(markup
|
(markup
|
||||||
(join (append .options
|
(join (append .options
|
||||||
(and .options
|
(and .options
|
||||||
(or .required
|
(or .required
|
||||||
.optional
|
.optional
|
||||||
.rest)
|
.rest)
|
||||||
(list (dark "[--]")))
|
(list (dark "[--]")))
|
||||||
.required
|
.required
|
||||||
.optional
|
.optional
|
||||||
.rest))))
|
.rest))))
|
||||||
80 (1+ (length (concat prefix command))))))
|
80 (1+ (length (concat prefix command)))))))))
|
||||||
(dolist (example (if with-examples? .examples))
|
|
||||||
(insert! ("%s\n%s\n" (markup (car example))
|
|
||||||
(if (cdr example)
|
|
||||||
(format "%s\n" (indent (markup (cdr example))
|
|
||||||
doom-print-indent-increment))))))
|
|
||||||
(string-trim-right (buffer-string))))))
|
|
||||||
|
|
||||||
;;; Help: arguments
|
;;; Help: arguments
|
||||||
(defun doom-cli-help--arguments (cli &optional all?)
|
(defun doom-cli-help--arguments (cli &optional all?)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue