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

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

[nongnu] elpa/nix-mode d6286ce43b 235/500: Add pcomplete support to nix.


From: ELPA Syncer
Subject: [nongnu] elpa/nix-mode d6286ce43b 235/500: Add pcomplete support to nix.el
Date: Sat, 29 Jan 2022 08:27:09 -0500 (EST)

branch: elpa/nix-mode
commit d6286ce43b8a52d3d19a7394f186b1a3796354b6
Author: Matthew Bauer <matthew.bauer@obsidian.systems>
Commit: Matthew Bauer <matthew.bauer@obsidian.systems>

    Add pcomplete support to nix.el
---
 nix.el | 98 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 98 insertions(+)

diff --git a/nix.el b/nix.el
index 12e9780e1f..02c92a1c16 100644
--- a/nix.el
+++ b/nix.el
@@ -16,6 +16,8 @@
 
 ;;; Code:
 
+(require 'pcomplete)
+
 (defgroup nix nil
   "Nix-related customizations"
   :group 'languages)
@@ -55,6 +57,102 @@
     (kill-buffer stdout)
     result))
 
+(defvar nix-commands
+  '("add-to-store"
+    "build"
+    "cat-nar"
+    "cat-store"
+    "copy"
+    "copy-sigs"
+    "dump-path"
+    "edit"
+    "eval"
+    "hash-file"
+    "hash-path"
+    "log"
+    "ls-nar"
+    "ls-store"
+    "optimise-store"
+    "path-info"
+    "ping-store"
+    "repl"
+    "run"
+    "search"
+    "show-config"
+    "show-derivation"
+    "sign-paths"
+    "to-base16"
+    "to-base32"
+    "to-base64"
+    "upgrade-nix"
+    "verify"
+    "why-depends"))
+
+(defvar nix-toplevel-options
+  '("-v"
+    "--verbose"
+    "-h"
+    "--help"
+    "--debug"
+    "--help-config"
+    "--option"
+    "--version"))
+
+(defvar nix-config-options
+  '("allowed-uris"
+    "allow-import-from-derivation"
+    "allow-new-priveleges"
+    "allowed-users"
+    "auto-optimise-store"
+    "builders"
+    "builders-use-substitutes"
+    "build-users-group"
+    "compress-build-log"
+    "connect-timeout"
+    "cores"
+    "extra-sandbox-paths"
+    "extra-substituters"
+    "fallback"
+    "fsync-metadata"
+    "hashed-mirrors"
+    "http-connections"
+    "keep-build-log"
+    "keep-derivations"
+    "keep-env-derivations"
+    "keep-outputs"
+    "max-build-log-size"
+    "max-jobs"
+    "max-silent-time"
+    "netrc-file"
+    "plugin-files"
+    "pre-build-hook"
+    "repeat"
+    "require-sigs"
+    "restrict-eval"
+    "sandbox"
+    "sandbox-dev-shm-size"
+    "sandbox-paths"
+    "secret-key-files"
+    "show-trace"
+    "substitute"
+    "substituters"
+    "system"
+    "timeout"
+    "trusted-public-keys"
+    "trusted-subtituters"
+    "trusted-users"))
+
+;;;###autoload
+(defun pcomplete/nix ()
+  "Completion for the nix command."
+  (while (pcomplete-match "^-" 0)
+    (pcomplete-here nix-toplevel-options)
+    (when (string= "--option"
+                   (nth (1- pcomplete-index) pcomplete-args))
+      (pcomplete-here nix-config-options)
+      (pcomplete-here)))
+  (pcomplete-here nix-commands))
+
 ;;;###autoload
 (defun nix-build (&optional attr dir)
   "Run nix-build.



reply via email to

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