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"