diff --git a/src/babashka/main.clj b/src/babashka/main.clj index be5be1b4..15872d2c 100644 --- a/src/babashka/main.clj +++ b/src/babashka/main.clj @@ -551,7 +551,9 @@ Use -- to separate script command line args from bb command line args. (if (str/ends-with? opt ".jar") :jar :file) opt :command-line-args (next options)) - (error (str "File does not exist: " opt) 1))))))) + (error (str (if (str/starts-with? opt ":") + "Task does not exist: " + "File does not exist: ") opt) 1))))))) opts-map))] opts)))) diff --git a/test/babashka/bb_edn_test.clj b/test/babashka/bb_edn_test.clj index 4d807443..760dc67f 100644 --- a/test/babashka/bb_edn_test.clj +++ b/test/babashka/bb_edn_test.clj @@ -20,6 +20,12 @@ (binding [test-utils/*bb-edn-path* (str bb-edn-file#)] ~@body))) +(deftest task-cli-test + (with-config {} + (is (thrown-with-msg? + Exception #"Task does not exist: :sum" + (bb :sum))))) + (deftest babashka-task-test (with-config {:tasks {:sum {:task/type :babashka :task/args ["-e" "(+ 1 2 3)"]}}}