Fix #1646: command-line-args are dropped when file exists with same name
This commit is contained in:
parent
0e1694f586
commit
28f9879e40
3 changed files with 8 additions and 7 deletions
|
|
@ -12,6 +12,7 @@ A preview of the next release can be installed from
|
|||
- Add `java.util.ScheduledFuture`
|
||||
- Support `Runnable` to be used without import
|
||||
- Allow `catch` to be used as var name
|
||||
- [#1646](https://github.com/babashka/babashka/issues/1646): command-line-args are dropped when file exists with same name
|
||||
|
||||
## 1.3.186 (2023-11-02)
|
||||
|
||||
|
|
|
|||
|
|
@ -741,11 +741,10 @@ Use bb run --help to show this help output.
|
|||
(if-not opt opts-map
|
||||
;; FILE > TASK > SUBCOMMAND
|
||||
(cond
|
||||
(.isFile (io/file opt))
|
||||
(if (or (:file opts-map) (:jar opts-map))
|
||||
opts-map ; we've already parsed the file opt
|
||||
(parse-file-opt options opts-map))
|
||||
|
||||
(and (not (or (:file opts-map)
|
||||
(:jar opts-map)))
|
||||
(.isFile (io/file opt)))
|
||||
(parse-file-opt options opts-map)
|
||||
(contains? tasks opt)
|
||||
(assoc opts-map
|
||||
:run opt
|
||||
|
|
@ -1181,7 +1180,6 @@ Use bb run --help to show this help output.
|
|||
edn)]
|
||||
(vreset! common/bb-edn edn)))
|
||||
opts (parse-opts args opts)
|
||||
;; _ (.println System/err (str bb-edn))
|
||||
min-bb-version (:min-bb-version bb-edn)]
|
||||
(System/setProperty "java.class.path" "")
|
||||
(when min-bb-version
|
||||
|
|
|
|||
|
|
@ -69,7 +69,9 @@
|
|||
(testing "file opts parsing does not mess with :command-line-args"
|
||||
(is (= {:prn true, :expressions ["(prn :foo)"]}
|
||||
(-> (let [opts (main/parse-file-opt ["-e" "(prn :foo)"] {})]
|
||||
(main/parse-opts ["-e" "(prn :foo)"] opts)))))))
|
||||
(main/parse-opts ["-e" "(prn :foo)"] opts)))))
|
||||
(is (= {:file "foo", :command-line-args ["README.md"]}
|
||||
(main/parse-opts ["README.md"] {:file "foo"})))))
|
||||
|
||||
(deftest version-test
|
||||
(is (= [1 0 0] (main/parse-version "1.0.0-SNAPSHOT")))
|
||||
|
|
|
|||
Loading…
Reference in a new issue