From e338bd5fff15b6c57c14ba4d54321d35605157b3 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Fri, 19 Nov 2021 17:56:39 -0800 Subject: editgroup description option for batch editing --- fatcat-cli/src/commands.rs | 6 +++++- fatcat-cli/src/main.rs | 24 +++++++++++++++++++++--- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/fatcat-cli/src/commands.rs b/fatcat-cli/src/commands.rs index 87a0f5a..da23c34 100644 --- a/fatcat-cli/src/commands.rs +++ b/fatcat-cli/src/commands.rs @@ -447,8 +447,12 @@ impl BatchGrouper { batch_size: u64, limit: Option, auto_accept: bool, + editgroup_description: Option, ) -> Self { - let editgroup_description = "part of a fatcat-cli batch operation".to_string(); + let editgroup_description = match editgroup_description { + Some(ed) => ed, + None => "part of a fatcat-cli batch operation".to_string(), + }; BatchGrouper { entity_type, batch_size, diff --git a/fatcat-cli/src/main.rs b/fatcat-cli/src/main.rs index 091d073..f4a8d57 100644 --- a/fatcat-cli/src/main.rs +++ b/fatcat-cli/src/main.rs @@ -108,6 +108,10 @@ enum BatchCommand { #[structopt(long, global = true)] auto_accept: bool, + + /// Editgroup description + #[structopt(long, short)] + description: Option, }, /// Update existing entities in batches @@ -120,6 +124,10 @@ enum BatchCommand { #[structopt(long)] auto_accept: bool, + + /// Editgroup description + #[structopt(long, short)] + description: Option, }, /// Delete entities in batches @@ -131,6 +139,10 @@ enum BatchCommand { #[structopt(long)] auto_accept: bool, + + /// Editgroup description + #[structopt(long, short)] + description: Option, }, /// Download multiple files @@ -484,12 +496,14 @@ fn run(opt: Opt) -> Result<()> { entity_type, batch_size, auto_accept, + description, }, input_path, limit, } => { let input_path = path_or_stdin(input_path); - let mut batch = BatchGrouper::new(entity_type, batch_size, limit, auto_accept); + let mut batch = + BatchGrouper::new(entity_type, batch_size, limit, auto_accept, description); batch.run(&mut api_client, input_path, BatchOp::Create, None)?; } Command::Batch { @@ -499,12 +513,14 @@ fn run(opt: Opt) -> Result<()> { mutations, batch_size, auto_accept, + description, }, input_path, limit, } => { let input_path = path_or_stdin(input_path); - let mut batch = BatchGrouper::new(entity_type, batch_size, limit, auto_accept); + let mut batch = + BatchGrouper::new(entity_type, batch_size, limit, auto_accept, description); batch.run( &mut api_client, input_path, @@ -518,12 +534,14 @@ fn run(opt: Opt) -> Result<()> { entity_type, batch_size, auto_accept, + description, }, input_path, limit, } => { let input_path = path_or_stdin(input_path); - let mut batch = BatchGrouper::new(entity_type, batch_size, limit, auto_accept); + let mut batch = + BatchGrouper::new(entity_type, batch_size, limit, auto_accept, description); batch.run(&mut api_client, input_path, BatchOp::Delete, None)?; } Command::Batch { -- cgit v1.2.3