From 6b4ff95035c25d29680f13b34757c4b31a71ed9b Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Sun, 28 Feb 2016 03:39:12 -0500 Subject: snakemake-all-rules: New command --- snakemake.el | 9 +++++++++ test-snakemake.el | 7 +++++++ 2 files changed, 16 insertions(+) diff --git a/snakemake.el b/snakemake.el index 8a985ee..396290a 100644 --- a/snakemake.el +++ b/snakemake.el @@ -173,6 +173,15 @@ with DIRECTORY and the Snakefile's modification time." "Call `snakemake-program' with ARGS and insert output." (apply #'call-process snakemake-program nil t nil args)) +(defun snakemake-all-rules (&optional directory) + "Return list of rules for DIRECTORY's Snakefile." + (snakemake-with-cache directory ("all-rules") + (split-string + (with-temp-buffer + (if (= 0 (snakemake-insert-output "--nocolor" "--list")) + (buffer-string) + (error "Error finding rules")))))) + (defun snakemake-rule-targets (&optional directory) "Return list of target rules for DIRECTORY's Snakefile." (snakemake-with-cache directory ("target-rules") diff --git a/test-snakemake.el b/test-snakemake.el index 03cf1f1..0f83821 100644 --- a/test-snakemake.el +++ b/test-snakemake.el @@ -672,6 +672,13 @@ rule abc: (snakemake-with-temp-dir (snakemake-rule-targets))))) +(ert-deftest test-snakemake/all-rules () + "Test `snakemake-all-rules'." + (should + (equal '("aa" "bb" "cc_wildcards" "dd_subdir") + (snakemake-with-temp-dir + (snakemake-all-rules))))) + (ert-deftest test-snakemake/file-targets () "Test `snakemake-file-targets'." (should -- cgit v1.2.3