File tree Expand file tree Collapse file tree 3 files changed +21
-6
lines changed
Expand file tree Collapse file tree 3 files changed +21
-6
lines changed Original file line number Diff line number Diff line change 22
33## Unreleased
44
5+ - Support ` ~ ` in dynamic string parser.
6+
57## 0.86.0
68
79- Improve agent behavior prompt to mention usage of editor_diagnostics tool. #230
Original file line number Diff line number Diff line change 159159 (string/replace #"\$\{ file:([^}]+)\} "
160160 (fn [[_match file-path]]
161161 (try
162- (slurp (str (if (fs/absolute? file-path)
163- file-path
164- (if cwd
165- (fs/path cwd file-path)
166- (fs/path file-path)))))
162+ (let [file-path (fs/expand-home file-path)]
163+ (slurp (str (if (fs/absolute? file-path)
164+ file-path
165+ (if cwd
166+ (fs/path cwd file-path)
167+ (fs/path file-path))))))
167168 (catch Exception _
168169 (logger/warn logger-tag " File not found when parsing string:" s)
169170 " " ))))
Original file line number Diff line number Diff line change 77 [eca.logger :as logger]
88 [eca.secrets :as secrets]
99 [eca.test-helper :as h]
10- [matcher-combinators.test :refer [match?]]))
10+ [matcher-combinators.test :refer [match?]]
11+ [clojure.string :as string]))
1112
1213(h/reset-components-before-test )
1314
282283 (throw (ex-info " File not found" {}))))]
283284 (is (= " relative file content" (#'config/parse-dynamic-string " ${file:test.txt}" " /tmp" {})))))
284285
286+ (testing " replaces file pattern with file content - path with ~"
287+ (with-redefs [fs/absolute? (fn [_] true )
288+ fs/path (fn [cwd file-path] (str cwd " /" file-path))
289+ fs/expand-home (fn [f]
290+ (string/replace (str f) " ~" " /home/user" ))
291+ slurp (fn [path]
292+ (if (= path " /home/user/foo/test.txt" )
293+ " relative file content"
294+ (throw (ex-info " File not found" {}))))]
295+ (is (= " relative file content" (#'config/parse-dynamic-string " ${file:~/foo/test.txt}" " /tmp" {})))))
296+
285297 (testing " replaces file pattern with empty string when file not found"
286298 (with-redefs [logger/warn (fn [& _] nil )
287299 fs/absolute? (fn [_] true )
You can’t perform that action at this time.
0 commit comments