Function: pcomplete/tar
pcomplete/tar is an autoloaded and byte-compiled function defined in
pcmpl-gnu.el.gz.
Signature
(pcomplete/tar)
Documentation
Completion for the GNU tar utility.
Source Code
;; Defined in /usr/src/emacs/lisp/pcmpl-gnu.el.gz
;;;###autoload
(defun pcomplete/tar ()
"Completion for the GNU tar utility."
;; options that end in an equal sign will want further completion...
(let (saw-option complete-within)
(while (pcomplete-match "^-" 0)
(setq saw-option t)
(if (pcomplete-match "^--" 0)
(cond
((pcomplete-match "^--\\([^= \t\n\f]*\\)\\'" 0)
(pcomplete-here* pcmpl-gnu--tar-long-options))
((pcomplete-match "\\`--directory=\\(.*\\)" 0)
(pcomplete-here* (pcomplete-dirs)
(pcomplete-match-string 1 0)))
((pcomplete-match "\\`--exclude-from=\\(.*\\)" 0)
(pcomplete-here* (pcomplete-entries)
(pcomplete-match-string 1 0)))
((pcomplete-match "\\`--\\(extract\\|list\\)\\'" 0)
(setq complete-within t))
((pcomplete-match "\\`--file=\\(.*\\)" 0)
(pcomplete-here* (pcomplete-dirs-or-entries
pcmpl-gnu-tarfile-regexp)
(pcomplete-match-string 1 0)))
((pcomplete-match "\\`--files-from=\\(.*\\)" 0)
(pcomplete-here* (pcomplete-entries)
(pcomplete-match-string 1 0)))
((pcomplete-match "\\`--group=\\(.*\\)" 0)
(pcomplete-here* (pcmpl-unix-group-names)
(pcomplete-match-string 1 0)))
((pcomplete-match "\\`--info-script=\\(.*\\)" 0)
(pcomplete-here* (pcomplete-entries)
(pcomplete-match-string 1 0)))
((pcomplete-match "\\`--new-volume-script=\\(.*\\)" 0)
(pcomplete-here* (pcomplete-entries)
(pcomplete-match-string 1 0)))
((pcomplete-match "\\`--owner=\\(.*\\)" 0)
(pcomplete-here* (pcmpl-unix-user-names)
(pcomplete-match-string 1 0)))
((pcomplete-match "\\`--rsh-command=\\(.*\\)" 0)
(pcomplete-here* (funcall pcomplete-command-completion-function)
(pcomplete-match-string 1 0)))
((pcomplete-match "\\`--starting-file=\\(.*\\)" 0)
(pcomplete-here* (pcomplete-entries)
(pcomplete-match-string 1 0)))
((pcomplete-match "\\`--use-compress-program=\\(.*\\)" 0)
(pcomplete-here* (funcall pcomplete-command-completion-function)
(pcomplete-match-string 1 0)))
((pcomplete-match "\\`--volno-file=\\(.*\\)" 0)
(pcomplete-here* (pcomplete-entries)
(pcomplete-match-string 1 0)))
(t
(pcomplete-here*)))
(pcomplete-opt "01234567ABCFGKLMNOPRSTUVWXZbcdfghiklmoprstuvwxz")
(when (pcomplete-match "\\`-\\'" 0)
(pcomplete-here*))))
(unless saw-option
(pcomplete-here
(mapcar #'char-to-string
(string-to-list
"01234567ABCFGIKLMNOPRSTUVWXZbcdfghiklmoprstuvwxz")))
(if (pcomplete-match "[xt]" 'first 1)
(setq complete-within t)))
(pcomplete-here (pcomplete-dirs-or-entries pcmpl-gnu-tarfile-regexp))
(while (pcomplete-here
(if (and complete-within
(let* ((fa (file-attributes (pcomplete-arg 1)))
(size (file-attribute-size fa)))
(and (numberp size)
(or (null large-file-warning-threshold)
(< size large-file-warning-threshold)))))
(let ((file (pcomplete-arg 1)))
(completion-table-dynamic
(lambda (_string)
(pcmpl-gnu-with-file-buffer
file (mapcar #'tar-header-name tar-parse-info)))))
(pcomplete-entries))
nil #'identity))))