Function: eshell--set-option

eshell--set-option is a byte-compiled function defined in esh-opt.el.gz.

Signature

(eshell--set-option NAME AI OPT VALUE OPTIONS OPT-VALS)

Documentation

Using NAME's remaining args (index AI), set the OPT within OPTIONS.

VALUE is the potential value of the OPT, coming from args like
"-fVALUE" or "--foo=VALUE", or nil if no value was supplied. If
OPT doesn't consume a value, return VALUE unchanged so that it can be processed later; otherwise, return nil.

If the OPT consumes an argument for its value and VALUE is nil, the argument list will be modified.

Source Code

;; Defined in /usr/src/emacs/lisp/eshell/esh-opt.el.gz
(defun eshell--set-option (name ai opt value options opt-vals)
  "Using NAME's remaining args (index AI), set the OPT within OPTIONS.
VALUE is the potential value of the OPT, coming from args like
\"-fVALUE\" or \"--foo=VALUE\", or nil if no value was supplied.  If
OPT doesn't consume a value, return VALUE unchanged so that it can be
processed later; otherwise, return nil.

If the OPT consumes an argument for its value and VALUE is nil, the
argument list will be modified."
  (if (not (nth 3 opt))
      (eshell-show-usage name options)
    (if (eq (nth 2 opt) t)
        (progn
          (setcdr (assq (nth 3 opt) opt-vals)
                  (or value
                      (if (> ai (length eshell--args))
                          (error "%s: missing option argument" name)
                        (pop (nthcdr ai eshell--args)))))
          nil)
      (setcdr (assq (nth 3 opt) opt-vals)
              (or (nth 2 opt) t))
      value)))