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:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user