feat: add --ids-only flag to --list mode for scripting

Outputs one ID per line with no header. Errors if used with any mode
other than --list. Works with both local and client (remote) list.
This commit is contained in:
2026-03-17 15:04:10 -03:00
parent 2452da52ef
commit cb56a398fa
5 changed files with 37 additions and 2 deletions

View File

@@ -1,6 +1,6 @@
use crate::client::KeepClient;
use crate::modes::common::{
ColumnType, OutputFormat, format_size, render_list_table_with_format, settings_output_format,
format_size, render_list_table_with_format, settings_output_format, ColumnType, OutputFormat,
};
use clap::Command;
use log::debug;
@@ -21,6 +21,13 @@ pub fn mode(
.collect();
let items = client.list_items(tags, "newest", 0, 100, &meta_filter)?;
if settings.ids_only {
for item in &items {
println!("{}", item.id);
}
return Ok(());
}
let output_format = settings_output_format(settings);
match output_format {