summary refs log tree commit diff
path: root/emacs/guix-help-vars.el
diff options
context:
space:
mode:
authorAlex Kost <alezost@gmail.com>2015-08-12 20:32:45 +0300
committerAlex Kost <alezost@gmail.com>2015-08-30 18:26:02 +0300
commit26476d5852f31097994113b88d9c51f1f4378c99 (patch)
tree89caa9b212fc4958a3abb1cc9c14ffbde8dc7384 /emacs/guix-help-vars.el
parent25a2839c9dfb72fc4eddf0621b80023f87fc2e2e (diff)
downloadguix-26476d5852f31097994113b88d9c51f1f4378c99.tar.gz
emacs: Add help variables.
* emacs/guix-pcomplete.el (guix-pcomplete-parse-package-regexp,
  guix-pcomplete-parse-command-regexp,
  guix-pcomplete-parse-long-option-regexp,
  guix-pcomplete-parse-short-option-regexp,
  guix-pcomplete-parse-list-regexp, guix-pcomplete-parse-regexp-group,
  guix-pcomplete-systems, guix-pcomplete-hash-formats,
  guix-pcomplete-refresh-subsets, guix-pcomplete-key-policies): Move and
  rename to ...
* emacs/guix-help-vars.el (guix-help-parse-package-regexp,
  guix-help-parse-command-regexp, guix-help-parse-long-option-regexp,
  guix-help-parse-short-option-regexp, guix-help-parse-list-regexp,
  guix-help-parse-regexp-group, guix-help-system-types,
  guix-help-hash-formats, guix-help-refresh-subsets,
  guix-help-key-policies): ...here.  New file.
  (guix-help-parse-option-regexp, guix-help-source-types,
  guix-help-verify-options, guix-help-elpa-archives): New variables.
* emacs.am (ELFILES): Add "guix-help-vars.el".
Diffstat (limited to 'emacs/guix-help-vars.el')
-rw-r--r--emacs/guix-help-vars.el108
1 files changed, 108 insertions, 0 deletions
diff --git a/emacs/guix-help-vars.el b/emacs/guix-help-vars.el
new file mode 100644
index 0000000000..8117d28f3e
--- /dev/null
+++ b/emacs/guix-help-vars.el
@@ -0,0 +1,108 @@
+;;; guix-help-vars.el --- Variables related to --help output
+
+;; Copyright © 2015 Alex Kost <alezost@gmail.com>
+
+;; This file is part of GNU Guix.
+
+;; GNU Guix is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Guix is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; This file provides regular expressions to parse various "guix
+;; ... --help" outputs and lists of non-receivable items (system types,
+;; hash formats, etc.).
+
+;;; Code:
+
+
+;;; Regexps for parsing "guix ..." outputs
+
+(defvar guix-help-parse-option-regexp
+  (rx bol "  "
+      (zero-or-one (group "-" (not (any "- ")))
+                   ",")
+      (one-or-more " ")
+      (group "--" (one-or-more (or wordchar "-")))
+      (group (zero-or-one "[")
+             (zero-or-one "="))
+      (zero-or-more (not space))
+      (one-or-more space)
+      (group (one-or-more any)))
+  "Common regexp used to find command options.")
+
+(defvar guix-help-parse-command-regexp
+  (rx bol "   "
+      (group wordchar (one-or-more (or wordchar "-"))))
+  "Regexp used to find guix commands.
+'Command' means any option not prefixed with '-'.  For example,
+guix subcommand, system action, importer, etc.")
+
+(defvar guix-help-parse-long-option-regexp
+  (rx (or "  " ", ")
+      (group "--" (one-or-more (or wordchar "-"))
+             (zero-or-one "=")))
+  "Regexp used to find long options.")
+
+(defvar guix-help-parse-short-option-regexp
+  (rx bol (one-or-more blank)
+      "-" (group (not (any "- "))))
+  "Regexp used to find short options.")
+
+(defvar guix-help-parse-package-regexp
+  (rx bol (group (one-or-more (not blank))))
+  "Regexp used to find names of the packages.")
+
+(defvar guix-help-parse-list-regexp
+  (rx bol (zero-or-more blank) "- "
+      (group (one-or-more (or wordchar "-"))))
+  "Regexp used to find various lists (lint checkers, graph types).")
+
+(defvar guix-help-parse-regexp-group 1
+  "Parenthesized expression of regexps used to find commands and
+options.")
+
+
+;;; Non-receivable lists of system types, hash formats, etc.
+
+(defvar guix-help-system-types
+  '("x86_64-linux" "i686-linux" "armhf-linux" "mips64el-linux")
+  "List of supported systems.")
+
+(defvar guix-help-source-types
+  '("package" "all" "transitive")
+  "List of supported sources types.")
+
+(defvar guix-help-hash-formats
+  '("nix-base32" "base32" "base16" "hex" "hexadecimal")
+  "List of supported hash formats.")
+
+(defvar guix-help-refresh-subsets
+  '("core" "non-core")
+  "List of supported 'refresh' subsets.")
+
+(defvar guix-help-key-policies
+  '("interactive" "always" "never")
+  "List of supported key download policies.")
+
+(defvar guix-help-verify-options
+  '("repair" "contents")
+  "List of supported 'verify' options")
+
+(defvar guix-help-elpa-archives
+  '("gnu" "melpa" "melpa-stable")
+  "List of supported ELPA archives.")
+
+(provide 'guix-help-vars)
+
+;;; guix-help-vars.el ends here