about summary refs log tree commit diff
path: root/parse.nix
diff options
context:
space:
mode:
authorSteve Purcell <steve@sanityinc.com>2020-06-20 15:59:29 +1200
committerSteve Purcell <steve@sanityinc.com>2020-06-20 16:01:01 +1200
commit257557be073e697c61e70005d32642ac9515451b (patch)
tree847f177fb03291df54a851118b55bf7e71c08a0d /parse.nix
parent1b7520aab8594c1e231974273db5d8515d415bc3 (diff)
downloadnixlib-257557be073e697c61e70005d32642ac9515451b.tar
nixlib-257557be073e697c61e70005d32642ac9515451b.tar.gz
nixlib-257557be073e697c61e70005d32642ac9515451b.tar.bz2
nixlib-257557be073e697c61e70005d32642ac9515451b.tar.lz
nixlib-257557be073e697c61e70005d32642ac9515451b.tar.xz
nixlib-257557be073e697c61e70005d32642ac9515451b.tar.zst
nixlib-257557be073e697c61e70005d32642ac9515451b.zip
Add docstring with example Package-Requires parse inputs and results
Diffstat (limited to 'parse.nix')
-rw-r--r--parse.nix13
1 files changed, 13 insertions, 0 deletions
diff --git a/parse.nix b/parse.nix
index 6244b6954fbe..3fc18b7f0a46 100644
--- a/parse.nix
+++ b/parse.nix
@@ -6,6 +6,19 @@ let
     (x: builtins.typeOf x == "string")
     (builtins.split _sep _s);
 
+  # Parse (all) Package-Requires elisp headers found in the input string
+  # `packageFile` into a list of package name strings.
+  #
+  # Example inputs:
+  #
+  #  ;; Package-Requires: ()
+  #  => [ ]
+  #  ;; Package-Requires: ((dash "2.12.1") (pkg-info "0.4") (let-alist "1.0.4") (seq "1.11") (emacs "24.3"))
+  #  => [ "dash" "pkg-info" "let-alist" "seq" "emacs" ]
+  #  ;; Package-Requires: (dash (pkg-info "0.4"))
+  #  => [ "dash" "pkg-info" ]
+  #  ;; Package-Requires: ((dash) (pkg-info "0.4"))
+  #  => [ "dash" "pkg-info" ]
   parsePackagesFromPackageRequires = packageFile:
     let
       lines = splitString "\r?\n" packageFile;