From d8cd25a84d07da808318c2b8f4e46004b15ba5f9 Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Sat, 27 Mar 2021 16:22:04 +0100 Subject: [PATCH] Make more awesome --- src/babashka/main.clj | 5 ++--- test/babashka/bb_edn_test.clj | 15 +++++++++++---- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/babashka/main.clj b/src/babashka/main.clj index c30151c8..778e3600 100644 --- a/src/babashka/main.clj +++ b/src/babashka/main.clj @@ -607,9 +607,8 @@ Use -- to separate script command line args from bb command line args. (let [cmd-line-args args] (parse-opts (seq (map str (concat cmd-line-args command-line-args))))) shell - (let [args (if (and (= 1 (count args)) - (string? (first args))) - (p/tokenize (first args)) + (let [args (if (string? (first args)) + (into (p/tokenize (first args)) (rest args)) args) args (into (vec args) command-line-args)] {:exec (fn [] diff --git a/test/babashka/bb_edn_test.clj b/test/babashka/bb_edn_test.clj index cef5bdec..3d3f9619 100644 --- a/test/babashka/bb_edn_test.clj +++ b/test/babashka/bb_edn_test.clj @@ -42,13 +42,20 @@ (is (fs/exists? temp-file)) (bb :clean) (is (not (fs/exists? temp-file))))) - (let [temp-dir (fs/create-temp-dir) - temp-file (fs/create-file (fs/path temp-dir "temp-file.txt"))] - (testing "tokenization" + (testing "tokenization" + (let [temp-dir (fs/create-temp-dir) + temp-file (fs/create-file (fs/path temp-dir "temp-file.txt"))] (with-config {:tasks {:clean ['shell (str "rm " (str temp-file))]}} (is (fs/exists? temp-file)) (bb :clean) - (is (not (fs/exists? temp-file))))))) + (is (not (fs/exists? temp-file))))) + (testing "first string is tokenized even with following args" + (let [temp-dir (fs/create-temp-dir) + temp-file (fs/create-file (fs/path temp-dir "temp-file.txt"))] + (with-config {:tasks {:clean ['shell (str "rm -rf " (str temp-file))]}} + (is (fs/exists? temp-file)) + (bb :clean) + (is (not (fs/exists? temp-file)))))))) (deftest sequential-task-test (testing ":and-do"