emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/system-packages 1acd87a 047/117: Add an optional ARGS f


From: Stefan Monnier
Subject: [elpa] externals/system-packages 1acd87a 047/117: Add an optional ARGS for package manager options & cleanup file
Date: Fri, 14 Dec 2018 17:02:06 -0500 (EST)

branch: externals/system-packages
commit 1acd87a58c7c3565830a9856c25adfbeacd39a5c
Author: Alex Branham <address@hidden>
Commit: Alex Branham <address@hidden>

    Add an optional ARGS for package manager options & cleanup file
---
 system-packages.el | 157 +++++++++++++++++++++++++++++++++--------------------
 1 file changed, 98 insertions(+), 59 deletions(-)

diff --git a/system-packages.el b/system-packages.el
index d9fd261..c1af564 100644
--- a/system-packages.el
+++ b/system-packages.el
@@ -28,7 +28,7 @@
 
 ;;; Commentary:
 
-;; This is a package to manage installed system packages. Useful
+;; This is a package to manage installed system packages.  Useful
 ;; functions include installing packages, removing packages, listing
 ;; installed packages, and others.
 
@@ -237,20 +237,27 @@
   "String containing the package manager to use.
 
 See `system-packages-supported-package-managers' for a list of
-supported software. Tries to be smart about selecting the
+supported software.  Tries to be smart about selecting the
 default."
   :type 'symbol)
 
 (defcustom system-packages-usesudo
   (cdr (assoc 'default-sudo (cdr (assoc system-packages-packagemanager
                                         
system-packages-supported-package-managers))))
-  "If non-nil, system-packages will use sudo for appropriate
-  commands. Tries to be smart for selecting the default.")
+  "If non-nil, system-packages uses sudo for appropriate commands.
 
-(defun system-packages--run-command (action &optional pack)
-  "ACTION can be `default-sudo', `install', `search',
-`uninstall' etc. Run the command according to
-`system-packages-supported-package-managers' and ACTION."
+Tries to be smart for selecting the default.")
+
+(defun system-packages--run-command (action &optional pack args)
+  "Run a command that affects system packages.
+
+ACTION can be `default-sudo', `install', `search', `uninstall'
+etc.  Run the command according to
+`system-packages-supported-package-managers' and ACTION.  PACK is
+used to operation on specific packages.
+
+ARGS gets passed to the command and is useful for passing options
+to the package manager."
   (let ((command
          (cdr (assoc action (cdr (assoc system-packages-packagemanager
                                         
system-packages-supported-package-managers))))))
@@ -261,106 +268,138 @@ default."
     (when system-packages-usesudo
       (setq command (mapcar (lambda (part) (concat "sudo " part)) command)))
     (setq command (mapconcat 'identity command " && "))
-    (async-shell-command (mapconcat 'identity (list command pack) " ") 
"*system-packages*")))
+    (setq command (mapconcat 'identity (list command pack) " "))
+    (when args
+      (setq command (concat command args)))
+    (async-shell-command command "*system-packages*")))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; functions on named packages
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 ;;;###autoload
-(defun system-packages-install (pack)
-  "Installs system packages using the package manager named in
-system-packages-packagemanager."
-  (interactive "sWhat package to install: ")
-  (system-packages--run-command 'install pack))
+(defun system-packages-install (pack &optional args)
+  "Install system packages.
+
+Use the package manager from `system-packages-packagemanager' to
+install PACK.  You may use ARGS to pass options to the package
+manger."
+  (system-packages--run-command 'install pack args))
 
 ;;;###autoload
-(defun system-packages-search (pack)
-  "Search for system packages using the package manager named in
-system-packages-packagemanager."
+(defun system-packages-search (pack &optional args)
+  "Search for system packages.
+
+Use the package manager named in `system-packages-packagemanager'
+to search for PACK.  You may use ARGS to pass options to the
+package manager."
   (interactive "sSearch string: ")
-  (system-packages--run-command 'search pack))
+  (system-packages--run-command 'search pack args))
 
 ;;;###autoload
-(defun system-packages-uninstall (pack)
-  "Uninstalls installed system packages using the package manager named in
-system-packages-packagemanager."
+(defun system-packages-uninstall (pack &optional args)
+  "Uninstall system packages.
+
+Uses the package manager named in
+`system-packages-packagemanager' to uninstall PACK.  You may use
+ARGS to pass options to the package manager."
   (interactive "sWhat package to uninstall: ")
-  (system-packages--run-command 'uninstall pack))
+  (system-packages--run-command 'uninstall pack args))
 
 ;;;###autoload
-(defun system-packages-list-dependencies-of (pack)
-  "List all the dependencies of PACK."
+(defun system-packages-list-dependencies-of (pack &optional args)
+  "List the dependencies of PACK.
+
+You may use ARGS to pass options to the package manager."
   (interactive "sWhat package to list dependencies of: ")
-  (system-packages--run-command 'list-dependencies-of pack))
+  (system-packages--run-command 'list-dependencies-of pack args))
 
 ;;;###autoload
-(defun system-packages-get-info (pack)
+(defun system-packages-get-info (pack &optional args)
   "Display local package information of PACK.
 
-With a prefix argument, display remote package information."
+With a prefix argument, display remote package information.  You
+may use ARGS to pass options to the package manager."
   (interactive "sWhat package to list info for: ")
   (if current-prefix-arg
-      (system-packages--run-command 'get-info-remote pack)
-    (system-packages--run-command 'get-info pack)))
+      (system-packages--run-command 'get-info-remote pack args)
+    (system-packages--run-command 'get-info pack args)))
 
 ;;;###autoload
-(defun system-packages-list-files-provided-by (pack)
-  "List the files provided by PACK."
+(defun system-packages-list-files-provided-by (pack &optional args)
+  "List the files provided by PACK.
+
+You may use ARGS to pass options to the package manager."
   (interactive "sWhat package to list provided files of: ")
-  (system-packages--run-command 'list-files-provided-by pack))
+  (system-packages--run-command 'list-files-provided-by pack args))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; functions that don't take a named package
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 ;;;###autoload
-(defun system-packages-update ()
-  "Updates installed system packages using the package manager named in
-system-packages-packagemanager."
+(defun system-packages-update (&optional args)
+  "Update system packages.
+
+Use the package manager `system-packages-packagemanager'.  You
+may use ARGS to pass options to the package manger."
   (interactive)
-  (system-packages--run-command 'update))
+  (system-packages--run-command 'update nil args))
 
 ;;;###autoload
-(defun system-packages-remove-orphaned ()
-  "This function removes orphaned packages (i.e. unused packages). using the 
package manager named in
-system-packages-packagemanager."
+(defun system-packages-remove-orphaned (&optional args)
+  "Remove orphaned packages.
+
+Uses the package manager named in
+`system-packages-packagemanager'.  You may use ARGS to pass
+options to the package manger."
   (interactive)
-  (system-packages--run-command 'remove-orphaned))
+  (system-packages--run-command 'remove-orphaned nil args))
 
 ;;;###autoload
-(defun system-packages-list-installed-packages (arg)
-  "List explicitly installed packages using the package manager
-named in system-packages-packagemanager. With
-\\[universal-argument], list all installed packages."
+(defun system-packages-list-installed-packages (all &optional args)
+  "List explicitly installed packages.
+
+Uses the package manager named in
+`system-packages-packagemanager'.  With
+\\[universal-argument] (for ALL), list all installed packages.
+You may use ARGS to pass options to the package manger."
   (interactive "P")
-  (if arg
-      (system-packages--run-command 'list-installed-packages-all)
-    (system-packages--run-command 'list-installed-packages)))
+  (if all
+      (system-packages--run-command 'list-installed-packages-all nil args)
+    (system-packages--run-command 'list-installed-packages nil args)))
 
 ;;;###autoload
-(defun system-packages-clean-cache ()
-  "Clean the cache of the package manager."
+(defun system-packages-clean-cache (&optional args)
+  "Clean the cache of the package manager.
+
+You may use ARGS to pass options to the package manger."
   (interactive)
-  (system-packages--run-command 'clean-cache))
+  (system-packages--run-command 'clean-cache nil args))
 
 ;;;###autoload
-(defun system-packages-log ()
-  "Show a log of the actions taken by the package manager."
+(defun system-packages-log (&optional args)
+  "Show a log from `system-packages-packagemanager'.
+
+You may use ARGS to pass options to the package manger."
   (interactive)
-  (system-packages--run-command 'log))
+  (system-packages--run-command 'log args))
 
 ;;;###autoload
-(defun system-packages-verify-all-packages ()
-  "Check that files owned by packages are present on the system."
+(defun system-packages-verify-all-packages (&optional args)
+  "Check that files owned by packages are present on the system.
+
+You may use ARGS to pass options to the package manger."
   (interactive)
-  (system-packages--run-command 'verify-all-packages))
+  (system-packages--run-command 'verify-all-packages nil args))
 
 ;;;###autoload
-(defun system-packages-verify-all-dependencies ()
-  "Verify that all required dependencies are installed on the system."
+(defun system-packages-verify-all-dependencies (&optional args)
+  "Verify that all required dependencies are installed on the system.
+
+You may use ARGS to pass options to the package manger."
   (interactive)
-  (system-packages--run-command 'verify-all-dependencies))
+  (system-packages--run-command 'verify-all-dependencies nil args))
 
 (provide 'system-packages)
 ;;; system-packages.el ends here



reply via email to

[Prev in Thread] Current Thread [Next in Thread]