feat: allow --list to accept item IDs for filtering

- Local and client/server modes now support ID-based filtering
- keep -l 1 2 3 lists specific items by ID
- keep -l --ids-only 1 2 3 outputs just those IDs
- Server API adds optional 'ids' query parameter to GET /api/item/
- KeepClient.list_items gains ids parameter
This commit is contained in:
2026-03-17 17:56:35 -03:00
parent 02f0c8d453
commit 074ba64805
7 changed files with 39 additions and 21 deletions

View File

@@ -253,6 +253,7 @@ impl KeepClient {
pub fn list_items(
&self,
ids: &[i64],
tags: &[String],
order: &str,
start: u64,
@@ -268,6 +269,15 @@ impl KeepClient {
params.push(("order".to_string(), order.to_string()));
params.push(("start".to_string(), start.to_string()));
params.push(("count".to_string(), count.to_string()));
if !ids.is_empty() {
params.push((
"ids".to_string(),
ids.iter()
.map(|i| i.to_string())
.collect::<Vec<_>>()
.join(","),
));
}
if !tags.is_empty() {
params.push(("tags".to_string(), tags.join(",")));
}