diff --git a/README.md b/README.md
index f076218b45..586ad997fe 100644
--- a/README.md
+++ b/README.md
@@ -1842,8 +1842,8 @@ which will halt execution.
- `path_exists(path)` - Returns `true` if the path points at an existing entity
and `false` otherwise. Traverses symbolic links, and returns `false` if the
path is inaccessible or points to a broken symlink.
-- `read_to_string(path)`master - Returns the content of file at
- `path` as string.
+- `read(path)`master - Returns the content of file at `path` as
+ string.
##### Error Reporting
diff --git a/src/function.rs b/src/function.rs
index d292955af5..104aeb0240 100644
--- a/src/function.rs
+++ b/src/function.rs
@@ -87,7 +87,7 @@ pub(crate) fn get(name: &str) -> Option {
"path_exists" => Unary(path_exists),
"prepend" => Binary(prepend),
"quote" => Unary(quote),
- "read_to_string" => Unary(read_to_string),
+ "read" => Unary(read),
"replace" => Ternary(replace),
"replace_regex" => Ternary(replace_regex),
"semver_matches" => Binary(semver_matches),
@@ -529,7 +529,7 @@ fn quote(_context: Context, s: &str) -> FunctionResult {
Ok(format!("'{}'", s.replace('\'', "'\\''")))
}
-fn read_to_string(context: Context, filename: &str) -> FunctionResult {
+fn read(context: Context, filename: &str) -> FunctionResult {
fs::read_to_string(context.evaluator.context.working_directory().join(filename))
.map_err(|err| format!("I/O error reading `{filename}`: {err}"))
}
diff --git a/tests/functions.rs b/tests/functions.rs
index e29e04112d..e4766325e0 100644
--- a/tests/functions.rs
+++ b/tests/functions.rs
@@ -1260,9 +1260,9 @@ fn style_unknown() {
}
#[test]
-fn read_to_string() {
+fn read() {
Test::new()
- .justfile("foo := read_to_string('bar')")
+ .justfile("foo := read('bar')")
.write("bar", "baz")
.args(["--evaluate", "foo"])
.stdout("baz")
@@ -1270,11 +1270,11 @@ fn read_to_string() {
}
#[test]
-fn read_to_string_not_found() {
+fn read_file_not_found() {
Test::new()
- .justfile("foo := read_to_string('bar')")
+ .justfile("foo := read('bar')")
.args(["--evaluate", "foo"])
- .stderr_regex(r"error: Call to function `read_to_string` failed: I/O error reading `bar`: .*")
+ .stderr_regex(r"error: Call to function `read` failed: I/O error reading `bar`: .*")
.status(EXIT_FAILURE)
.run();
}