Function: transient-arg-value

transient-arg-value is a byte-compiled function defined in transient.el.gz.

Signature

(transient-arg-value ARG ARGS)

Documentation

Return the value of ARG as it appears in ARGS.

For a switch return a boolean. For an option return the value as a string, using the empty string for the empty value, or nil if the option does not appear in ARGS.

Append "=to ARG to indicate that it is an option.

Source Code

;; Defined in /usr/src/emacs/lisp/transient.el.gz
;;;;; Utilities

(defun transient-arg-value (arg args)
  "Return the value of ARG as it appears in ARGS.

For a switch return a boolean.  For an option return the value as
a string, using the empty string for the empty value, or nil if
the option does not appear in ARGS.

Append \"=\ to ARG to indicate that it is an option."
  (save-match-data
    (cond*
      ((member arg args) t)
      ((bind-and*
         (_(string-suffix-p "=" arg))
         (match (let ((case-fold-search nil)
                      (re (format "\\`%s\\(?:=\\(.+\\)\\)?\\'"
                                  (substring arg 0 -1))))
                  (cl-find-if (lambda (a)
                                (and (stringp a)
                                     (string-match re a)))
                              args))))
       (match-string 1 match)))))