Last active
December 17, 2015 23:19
-
-
Save dhaley/5688333 to your computer and use it in GitHub Desktop.
drush eshell completion
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;**** Drush Completion | |
(defun pcmpl-drush-commands () | |
"Return the most common drush commands by parsing the drush output." | |
(with-temp-buffer | |
(call-process-shell-command "drush" nil (current-buffer) nil | |
"--early=includes/complete.inc") | |
(goto-char 0) | |
(let (commands) | |
(while (re-search-forward | |
"^[[:blank:]]*\\([@]?[[:word:]-.]+\\)" | |
nil t) | |
(push (match-string 1) commands)) | |
(sort commands #'string<)))) | |
(pcmpl-drush-commands) | |
(defconst pcmpl-drush-commands (pcmpl-drush-commands) | |
"List of `drush' commands.") | |
(defun pcomplete/drush () | |
"Completion for `drush'." | |
;; Completion for the command argument. | |
(pcomplete-here* pcmpl-drush-commands) | |
(cond | |
((pcomplete-match "help" 1) | |
(pcomplete-here* pcmpl-drush-commands)) | |
(t | |
(while (pcomplete-here (pcomplete-entries)))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment