You've already forked macports-user-chunyang
mirror of
https://github.com/macports/macports-user-chunyang.git
synced 2026-07-12 18:20:29 -07:00
users/chunyang: port.el: Add helm-port, new command
git-svn-id: https://svn.macports.org/repository/macports/users/chunyang@137701 d073be05-634f-4543-b044-5fe20cf6d1d6
This commit is contained in:
@@ -51,5 +51,26 @@ Letters do not insert themselves; instead, they are commands. "
|
||||
(tabulated-list-print t)
|
||||
(switch-to-buffer buf))))
|
||||
|
||||
;;;###autoload
|
||||
(defun helm-port ()
|
||||
(interactive)
|
||||
(and
|
||||
(require 'helm nil t)
|
||||
(require 'subr-x nil t)
|
||||
(helm :sources
|
||||
(helm-build-sync-source "MacPorts"
|
||||
:candidates (lambda ()
|
||||
(mapcar
|
||||
#'string-trim
|
||||
(split-string
|
||||
(shell-command-to-string "port -q installed requested")
|
||||
"\n")))
|
||||
:action '(("Go to home page" .
|
||||
(lambda (candidate)
|
||||
(when-let ((string candidate) (regexp " (active)")
|
||||
(index (string-match regexp string)))
|
||||
(setq candidate (substring string 0 index)))
|
||||
(shell-command (concat "port gohome " candidate)))))))))
|
||||
|
||||
(provide 'port)
|
||||
;;; port.el ends here
|
||||
|
||||
Reference in New Issue
Block a user