summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2016-04-17 18:27:15 -0400
committerKyle Meyer <kyle@kyleam.com>2016-04-17 19:05:03 -0400
commit4b019984497913a770cf9d29f56f64e8bb5e0673 (patch)
treeffea7e430b791ab43d76f63227ff1583da6116a3
parent2682860608862b99adbe830c289efe9897700fc1 (diff)
downloadsnakemake-mode-4b019984497913a770cf9d29f56f64e8bb5e0673.tar.gz
Filter out anonymous rules from rule lists
-rw-r--r--snakemake-test.el4
-rw-r--r--snakemake.el26
2 files changed, 17 insertions, 13 deletions
diff --git a/snakemake-test.el b/snakemake-test.el
index 274ce56..3bac276 100644
--- a/snakemake-test.el
+++ b/snakemake-test.el
@@ -715,13 +715,13 @@ rule abc:
(ert-deftest snakemake-test-rule-targets ()
(should
- (equal '("aa" "bb" "dd_subdir" "5")
+ (equal '("aa" "bb" "dd_subdir")
(snakemake-with-temp-dir
(snakemake-rule-targets)))))
(ert-deftest snakemake-test-all-rules ()
(should
- (equal '("aa" "bb" "cc_wildcards" "dd_subdir" "5")
+ (equal '("aa" "bb" "cc_wildcards" "dd_subdir")
(snakemake-with-temp-dir
(snakemake-all-rules)))))
diff --git a/snakemake.el b/snakemake.el
index cc6bc3f..fa200bd 100644
--- a/snakemake.el
+++ b/snakemake.el
@@ -211,21 +211,25 @@ with DIRECTORY and the Snakefile's modification time."
(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"))))))
+ (cl-remove-if
+ (lambda (x) (string-match-p "\\`[0-9]+\\'" x))
+ (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")
- (split-string
- (with-temp-buffer
- (if (= 0 (snakemake-insert-output
- "--nocolor" "--list-target-rules"))
- (buffer-string)
- (error "Error finding rule targets"))))))
+ (cl-remove-if
+ (lambda (x) (string-match-p "\\`[0-9]+\\'" x))
+ (split-string
+ (with-temp-buffer
+ (if (= 0 (snakemake-insert-output
+ "--nocolor" "--list-target-rules"))
+ (buffer-string)
+ (error "Error finding rule targets")))))))
(defun snakemake-file-targets (&optional directory)
"Return list of output files for DIRECTORY's Snakefile.