diff --git a/src/babashka/main.clj b/src/babashka/main.clj index d77ce979..776ba139 100644 --- a/src/babashka/main.clj +++ b/src/babashka/main.clj @@ -601,7 +601,9 @@ Use bb run --help to show this help output. ("--main", "-m",) (let [options (next options)] (assoc opts-map :main (first options) - :command-line-args (rest options))) + :command-line-args (if (= "--" (second options)) + (nthrest options 2) + (rest options)))) ("--run") (parse-run-opts opts-map (next options)) ("--tasks") diff --git a/test/babashka/main_test.clj b/test/babashka/main_test.clj index 0e215388..4dbe6ecb 100644 --- a/test/babashka/main_test.clj +++ b/test/babashka/main_test.clj @@ -59,7 +59,8 @@ (is (:babashka/version v)) (is (:feature/xml v))) (is (= {:force? true} (parse-opts ["--force"]))) - (is (= {:main "foo", :command-line-args '("-h")} (parse-opts ["-m" "foo" "-h"])))) + (is (= {:main "foo", :command-line-args '("-h")} (parse-opts ["-m" "foo" "-h"]))) + (is (= {:main "foo", :command-line-args '("-h")} (parse-opts ["-m" "foo" "--" "-h"])))) (deftest version-test (is (= [1 0 0] (main/parse-version "1.0.0-SNAPSHOT")))