summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@archive.org>2021-11-19 17:56:39 -0800
committerBryan Newbold <bnewbold@archive.org>2021-11-19 17:57:25 -0800
commite338bd5fff15b6c57c14ba4d54321d35605157b3 (patch)
tree9edb95bdd148cee4a652e95f8aafcb3b05a1f65e
parent1cca4833557aa8cbc8d6219dd98ec86cef04ef5d (diff)
downloadfatcat-cli-e338bd5fff15b6c57c14ba4d54321d35605157b3.tar.gz
fatcat-cli-e338bd5fff15b6c57c14ba4d54321d35605157b3.zip
editgroup description option for batch editing
-rw-r--r--fatcat-cli/src/commands.rs6
-rw-r--r--fatcat-cli/src/main.rs24
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<u64>,
auto_accept: bool,
+ editgroup_description: Option<String>,
) -> 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<String>,
},
/// Update existing entities in batches
@@ -120,6 +124,10 @@ enum BatchCommand {
#[structopt(long)]
auto_accept: bool,
+
+ /// Editgroup description
+ #[structopt(long, short)]
+ description: Option<String>,
},
/// Delete entities in batches
@@ -131,6 +139,10 @@ enum BatchCommand {
#[structopt(long)]
auto_accept: bool,
+
+ /// Editgroup description
+ #[structopt(long, short)]
+ description: Option<String>,
},
/// 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 {