Skip to content
This repository has been archived by the owner on Jun 7, 2018. It is now read-only.

Commit

Permalink
Add system-packages-ensure
Browse files Browse the repository at this point in the history
Also an alias for system-packages-package-installed-p to
executable-find.  This is somewhat related to bug #26, since you can
now do something clever with if statments: if pack-man=apt, then
ensure blah, else if pack-man=pacman, ensure blah-foo.

Obviously, there's still work to be done here.
  • Loading branch information
jabranham committed Apr 25, 2018
1 parent 8fc1a5c commit ede298f
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions system-packages.el
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,22 @@ manger."
(interactive "sPackage to install: ")
(system-packages--run-command 'install pack args))

;;;###autoload
(defun system-packages-ensure (pack &optional args)
"Ensure PACK is installed on system.
Search for PACK with `system-packages-package-installed-p', and
install the package if not found. Use ARGS to pass options to
the package manager."
(if (system-packages-package-installed-p pack)
t
(system-packages-install pack args)))

;;;###autoload
(defalias 'system-packages-package-installed-p #'executable-find
"Return t if PACK is installed.
Currently an alias for `executable-find', so it will give wrong
results if the package and executable names are different.")

;;;###autoload
(defun system-packages-search (pack &optional args)
"Search for system packages.
Expand Down

0 comments on commit ede298f

Please sign in to comment.