%PDF- %PDF-
Direktori : /usr/local/share/emacs/27.2/lisp/eshell/ |
Current File : //usr/local/share/emacs/27.2/lisp/eshell/esh-opt.elc |
;ELC ;;; Compiled ;;; in Emacs version 27.2 ;;; with all optimizations. ;;; This file uses dynamic docstrings, first added in Emacs 19.29. ;;; This file does not contain utf-8 non-ASCII characters, ;;; and so can be loaded in Emacs versions earlier than 23. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (require 'esh-util) #@2747 Process NAME's MACRO-ARGS using a set of command line OPTIONS. After doing so, stores settings in local symbols as declared by OPTIONS; then evaluates BODY-FORMS -- assuming all was OK. OPTIONS is a list, beginning with one or more elements of the form: (SHORT LONG VALUE SYMBOL HELP-STRING) Each of these elements represents a particular command-line switch. SHORT is either nil, or a character that can be used as a switch -SHORT. LONG is either nil, or a string that can be used as a switch --LONG. At least one of SHORT and LONG must be non-nil. VALUE is the value associated with the option. It can be either: t - the option needs a value to be specified after the switch; nil - the option is given the value t; anything else - specifies the actual value for the option. SYMBOL is either nil, or the name of the Lisp symbol that will be bound to VALUE. A nil SYMBOL calls `eshell-show-usage', and so is appropriate for a "--help" type option. HELP-STRING is a documentation string for the option. Any remaining elements of OPTIONS are :KEYWORD arguments. Some take arguments, some do not. The recognized :KEYWORDS are: :external STRING STRING is an external command to run if there are unknown switches. :usage STRING STRING is the initial part of the command's documentation string. It appears before the options are listed. :post-usage STRING STRING is an optional trailing part of the command's documentation string. It appears after the options, but before the final part of the documentation about the associated external command (if there is one). :show-usage If present, then show the usage message if the command is called with no arguments. :preserve-args If present, do not pass MACRO-ARGS through `flatten-tree' and `eshell-stringify-list'. :parse-leading-options-only If present, do not parse dash or switch arguments after the first positional argument. Instead, treat them as positional arguments themselves. For example, OPTIONS might look like: ((?C nil nil multi-column "multi-column display") (nil "help" nil nil "show this usage display") (?r "reverse" nil reverse-list "reverse order while sorting") :external "ls" :usage "[OPTION]... [FILE]... List information about the FILEs (the current directory by default). Sort entries alphabetically across.") `eshell-eval-using-options' returns the value of the last form in BODY-FORMS. If instead an external command is run (because of an unknown option), the tag `eshell-external' will be thrown with the new process for its value. Lastly, any remaining arguments will be available in the locally let-bound variable `args'. (fn NAME MACRO-ARGS OPTIONS &rest BODY-FORMS) (defalias 'eshell-eval-using-options '(macro . #[899 "\300\301\302A@>\203 \202 \303\304DDD\305\306\307BBBD\310\311\312\313\314\315\nA@\"\"!\316\"BB\317BBB\207" [let* temp-args :preserve-args eshell-stringify-list flatten-tree processed-args eshell--do-opts (temp-args) append delete-dups delq nil mapcar #[257 "\211<\205 \3008\205 \3008\301B\207" [3 ((pop processed-args))] 3 "\n\n(fn OPT)"] ((args processed-args)) (ignore args)] 14 (#$ . 430)])) (put 'eshell-eval-using-options 'edebug-form-spec '(form form sexp body)) #@137 Helper function for `eshell-eval-using-options'. This code doesn't really need to be macro expanded everywhere. (fn NAME OPTIONS ARGS) (defalias 'eshell--do-opts #[771 "\300\301!\210\30224 \3032) \211G\304U\203 \305>\203 \306\"\202( \307#\262\3100\211\2051 \311\312\"\2620\211\203B \313\314\315\"\"\202C \207" [require esh-ext eshell-ext-command eshell-usage 0 :show-usage eshell-show-usage eshell--process-args nil error "%s" throw eshell-external eshell-external-command] 9 (#$ . 3721)]) #@71 Display the usage message for NAME, using OPTIONS. (fn NAME OPTIONS) (defalias 'eshell-show-usage #[514 "\300\301!\210\302\303\304>A@#\305>\306>\307\203 @<\203x @\310\262\211@\203D \211A@\203D \302\311\302\312@A@#\3138#P\262\202w \211@\203[ \302\311\302\314@\"\3138#P\262\202w \211A@\203t \302\311\302\315A@\"\3138#P\262\202w \307\262\210A\262\202 \203\217 \205\211 \316A@Q\262\203\246 \317A@!\262\203\246 \320\321\"P\262\322\323\"\207" [require esh-ext format "usage: %s %s\n\n" :usage :external :post-usage nil t " %-20s %s\n" "-%c, --%s" 4 "-%c" " --%s" "\n" eshell-search-path format-message "\nThis command is implemented in Lisp. If an unrecognized option is\npassed to this command, the external version `%s'\nwill be called instead." throw eshell-usage] 14 (#$ . 4232)]) #@190 Using NAME's remaining args (index AI), set the OPT within OPTIONS. If the option consumes an argument for its value, the argument list will be modified. (fn NAME AI OPT OPTIONS OPT-VALS) (defalias 'eshell--set-option #[1285 "\3018\204 \302\"\207\3018\236\3038\304=\203F GV\203' \305\306\"\202M \211\233\211\307X\2038 A\202@ S\233A\241\210\266\202\242\202M \3038\206M \304\241\207" [eshell--args 3 eshell-show-usage 2 t error "%s: missing option argument" 0] 11 (#$ . 5066)]) #@514 For NAME, process SWITCH (of type KIND), from args at index AI. The SWITCH will be looked up in the set of OPTIONS. SWITCH should be either a string or character. KIND should be the integer 0 if it's a character, or 1 if it's a string. The SWITCH is then be matched against OPTIONS. If no matching handler is found, and an :external command is defined (and available), it will be called; otherwise, an error will be triggered to say that the switch is unrecognized. (fn NAME SWITCH KIND AI OPTIONS OPT-VALS) (defalias 'eshell--process-option #[1542 "\300\203; @<\2034 @8\2034 @8\232\2034 \301@%\210\302\262\300\262\202 A\262\202 \211?\205m \303>\211\205k \304A@!\262\211\203Y \305\306\"\202k \307\310 !\203e \311\202f \312\n\n#\262\207" [nil eshell--set-option t :external eshell-search-path throw eshell-ext-command error characterp "%s: unrecognized option -%c" "%s: unrecognized option --%s"] 14 (#$ . 5570)]) #@63 Process the given ARGS using OPTIONS. (fn NAME ARGS OPTIONS) (defalias 'eshell--process-args #[771 "\301C\302\301\303\304\305\306\307\310!\311\"\312\313%\"\"\314\301\301GW\203\263 \211\203, \315>\204\263 8\262;\203= \316\317\"\204G T\262\320\262\202 \321\322\"\321\323\"\211\233\314X\203_ \211A\202g S\233A\241\210\266\203\214 \211G\314V\203\205 \324\n\322\f&\210\202\256 G\262\202\256 \211G\314\211W\203\254 \324\fH\314\n &\210\211T\262\202\217 \266\266\202 \303\325\"\244)\207" [eshell--args nil delq mapcar make-byte-code 257 "\211<\205 \3018\211\205 \211\300\242>?\205 \300\300\242B\240\210\211C\262\207" vconcat vector [3] 5 "\n\n(fn OPT)" 0 :parse-leading-options-only string-match "^-\\(-\\)?\\(.*\\)" t match-string 1 2 eshell--process-option cdr] 19 (#$ . 6527)]) (provide 'esh-opt)