Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Clarify file list search wording and cover sorted incomplete results

laurenspriem634560bc7fa3
diff --git a/docs/docs/cli/photos.md b/docs/docs/cli/photos.md
index e87364ac42..f074f83a51 100644
--- a/docs/docs/cli/photos.md
+++ b/docs/docs/cli/photos.md
@@ -100,7 +100,7 @@ ente photos file list --sort size --limit 20
- `--type` takes `image`, `video` or `livephoto`; repeat it to include several types.
- `--since` and `--before` compare `createdAt`, which includes dates edited in Ente. `--since` includes the given instant and `--before` excludes it. Both accept `YYYY-MM-DD` (midnight UTC) or RFC 3339 with a timezone, such as `2024-06-01T00:00:00+02:00`.
-- `--search` finds files whose name or caption contains every word, ignoring case.
+- `--search` finds files where every word occurs in either the name or the caption, ignoring case.
- `--no-location` keeps files without a location.
A file must match every filter you pass. `--sort created` lists the newest files first and `--sort size` the largest first; add `--reverse` for the opposite order. Files with an unknown size sort as the smallest, and ties keep ID order. Without `--sort`, files are listed by ID.
diff --git a/rust/apps/cli/src/args.rs b/rust/apps/cli/src/args.rs
index 1e849edb06..80664d71d4 100644
--- a/rust/apps/cli/src/args.rs
+++ b/rust/apps/cli/src/args.rs
@@ -611,7 +611,7 @@ pub struct FileQuery {
value_name = "TEXT",
value_parser = nonempty_search,
help = "Find files by words in their name or caption",
- long_help = "Find files whose name or caption contains every word of TEXT, ignoring case. Quote text containing spaces."
+ long_help = "Find files where every word of TEXT occurs in either the name or the caption, ignoring case. Quote text containing spaces."
)]
pub search: Option<String>,
#[arg(long, help = "Include only files without a location")]
diff --git a/rust/apps/cli/tests/cli/files.rs b/rust/apps/cli/tests/cli/files.rs
index ccfe64b9ee..efbc7bbf59 100644
--- a/rust/apps/cli/tests/cli/files.rs
+++ b/rust/apps/cli/tests/cli/files.rs
@@ -577,7 +577,7 @@ fn photos_lists_limit_output_and_stream_complete_results() {
)
.unwrap();
drop(connection);
- for as_json in [false, true] {
+ for (as_json, sorted) in [(false, false), (true, false), (false, true), (true, true)] {
let mut args = vec![
"--offline",
"photos",
@@ -590,6 +590,9 @@ fn photos_lists_limit_output_and_stream_complete_results() {
if as_json {
args.push("--json");
}
+ if sorted {
+ args.extend(["--sort", "created"]);
+ }
let output = home.run(&args);
assert!(failure(&output).contains("timestamp is outside the supported range"));
assert!(String::from_utf8_lossy(&output.stdout).contains("Edited 🌧.jpg"));
@@ -683,6 +686,7 @@ fn file_lists_filter_and_sort_synced_metadata() {
(vec!["--search", "family dinner"], vec![3]),
(vec!["--search", "holiday jpg"], vec![4]),
(vec!["--search", "beach dinner"], vec![]),
+ (vec!["--search", "jpg sunset"], vec![1]),
(vec!["--no-location"], vec![2, 4]),
(vec!["--type", "image", "--no-location"], vec![4]),
(vec!["--sort", "created"], vec![3, 2, 4, 1]),