summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlex Kost <alezost@gmail.com>2015-10-28 20:48:45 +0300
committerAlex Kost <alezost@gmail.com>2015-10-31 23:21:23 +0300
commitb0e44d4f7d13b1c67899aab14385155cc648cfd8 (patch)
tree84bc2c07a7295ba9ca3c66080eb1370102d5080e
parentd9b9454c9865c148afc8498837e077581e43037d (diff)
downloadguix-b0e44d4f7d13b1c67899aab14385155cc648cfd8.tar.gz
emacs: Add shell completions for 'guix refresh --type'.
* emacs/guix-pcomplete.el (guix-pcomplete-refresh-updaters): New function.
  (guix-pcomplete-complete-option-arg): Complete '-t/--type' option for
  'guix refresh' command.
-rw-r--r--emacs/guix-pcomplete.el17
1 files changed, 14 insertions, 3 deletions
diff --git a/emacs/guix-pcomplete.el b/emacs/guix-pcomplete.el
index 98f8efd1d2..85b267a78d 100644
--- a/emacs/guix-pcomplete.el
+++ b/emacs/guix-pcomplete.el
@@ -128,6 +128,13 @@ subcommands, actions, etc. for this guix COMMAND."
    guix-help-parse-regexp-group
    "graph" "--list-types"))
 
+(guix-memoized-defun guix-pcomplete-refresh-updaters ()
+  "Return a list of all available refresh updater types."
+  (guix-pcomplete-run-guix-and-search
+   guix-help-parse-list-regexp
+   guix-help-parse-regexp-group
+   "refresh" "--list-updaters"))
+
 
 ;;; Completing
 
@@ -287,9 +294,13 @@ INPUT is the current partially completed string."
            (option? "-u" "--user"))
       (complete* (pcmpl-unix-user-names)))
 
-     ((and (command? "refresh")
-           (option? "-s" "--select"))
-      (complete* guix-help-refresh-subsets))
+     ((command? "refresh")
+      (cond
+       ((option? "-s" "--select")
+        (complete* guix-help-refresh-subsets))
+       ((option? "-t" "--type")
+        (guix-pcomplete-complete-comma-args
+         (guix-pcomplete-refresh-updaters)))))
 
      ((and (command? "size")
            (option? "-m" "--map-file"))