From c474855cab906e939c88a87b8c7feb51cdaeb942 Mon Sep 17 00:00:00 2001 From: guns Date: Tue, 18 Feb 2014 22:47:08 -0600 Subject: [PATCH] Add -E/--escape-chars cli option --- src/cljx/frak/cli.cljx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/cljx/frak/cli.cljx b/src/cljx/frak/cli.cljx index 7011711..57dd529 100644 --- a/src/cljx/frak/cli.cljx +++ b/src/cljx/frak/cli.cljx @@ -38,6 +38,11 @@ :id :exact?] ["-c" "--capture" "Generated pattern captures" :id :capture?] + ["-E" "--escape-chars :KEY|'CHARS'" + "Set of characters to escape in generated pattern" + :parse-fn #(if (= (first %) \:) + (keyword (subs % 1)) + (set (map first (re-seq #"." %))))] ["-h" "--help" "Display this help message"]]) (defn -main @@ -50,7 +55,9 @@ (exit 1)) (if (or (empty? words) (:help options)) (log (str "Usage: frak \n\nFlags:\n" summary)) - (log (frak/string-pattern words (select-keys options [:exact? :capture?])))) + (log (frak/string-pattern + words + (select-keys options [:exact? :capture? :escape-chars])))) (exit 0))) #+cljs (set! *main-cli-fn* -main) -- 2.25.1