Tokenization

This commit is contained in:
Michiel Borkent 2021-03-27 13:01:46 +01:00
parent 6ecc70710e
commit 344ce2dca7
2 changed files with 13 additions and 2 deletions

View file

@ -587,7 +587,11 @@ Use -- to separate script command line args from bb command line args.
(let [cmd-line-args args] (let [cmd-line-args args]
(parse-opts (seq (map str (concat cmd-line-args command-line-args))))) (parse-opts (seq (map str (concat cmd-line-args command-line-args)))))
:shell :shell
(let [args (into (vec args) command-line-args)] (let [args (if (and (= 1 (count args))
(string? (first args)))
(p/tokenize (first args))
args)
args (into (vec args) command-line-args)]
{:exec (fn [] {:exec (fn []
[nil [nil
(-> (p/process args {:inherit true}) (-> (p/process args {:inherit true})

View file

@ -42,7 +42,14 @@
(with-config {:tasks {:clean [:shell "rm" (str temp-file)]}} (with-config {:tasks {:clean [:shell "rm" (str temp-file)]}}
(is (fs/exists? temp-file)) (is (fs/exists? temp-file))
(bb :clean) (bb :clean)
(is (not (fs/exists? temp-file)))))) (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"
(with-config {:tasks {:clean [:shell (str "rm " (str temp-file))]}}
(is (fs/exists? temp-file))
(bb :clean)
(is (not (fs/exists? temp-file)))))))
(deftest sequential-task-test (deftest sequential-task-test
(testing ":and-do" (testing ":and-do"