Function: eshell--invoke-command-directly-p

eshell--invoke-command-directly-p is a byte-compiled function defined in esh-cmd.el.gz.

Signature

(eshell--invoke-command-directly-p COMMAND)

Documentation

Determine whether the given COMMAND can be invoked directly.

COMMAND should be a non-top-level Eshell command in parsed form.

A command can be invoked directly if all of the following are true:

* The command is of the form
  (eshell-with-copied-handles
   (eshell-do-command (eshell-named-command NAME [ARGS]))).

* NAME is a string referring to an alias function and isn't a
  complex command (see eshell-complex-commands).

* Any subcommands in ARGS can also be invoked directly.

Source Code

;; Defined in /usr/src/emacs/lisp/eshell/esh-cmd.el.gz
(defun eshell--invoke-command-directly-p (command)
  "Determine whether the given COMMAND can be invoked directly.
COMMAND should be a non-top-level Eshell command in parsed form.

A command can be invoked directly if all of the following are true:

* The command is of the form
  (eshell-with-copied-handles
   (eshell-do-command (eshell-named-command NAME [ARGS]))).

* NAME is a string referring to an alias function and isn't a
  complex command (see `eshell-complex-commands').

* Any subcommands in ARGS can also be invoked directly."
  (pcase command
    (`(eshell-with-copied-handles
       (eshell-do-command (eshell-named-command ,name . ,args)))
     (and name (stringp name)
	  (not (member name eshell-complex-commands))
	  (catch 'simple
	    (dolist (pred eshell-complex-commands t)
	      (when (and (functionp pred)
                         (funcall pred name))
                (throw 'simple nil))))
	  (eshell-find-alias-function name)
          (catch 'indirect-subcommand
            (iter-do (subcommand (eshell--find-subcommands (car args)))
              (unless (eshell--invoke-command-directly-p subcommand)
                (throw 'indirect-subcommand nil)))
            t)))))