summaryrefslogtreecommitdiffstats
path: root/fatcat-cli/src/main.rs
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@archive.org>2021-02-13 20:38:55 -0800
committerBryan Newbold <bnewbold@archive.org>2021-02-13 20:38:55 -0800
commit658401529378bf7bdc6747ae1745d76732fd51f9 (patch)
treecccd649c0acfe28f01eabbd31e003c7593c2b45b /fatcat-cli/src/main.rs
parent83d7d8db54d90142d840ba6179dde99622683556 (diff)
downloadfatcat-cli-658401529378bf7bdc6747ae1745d76732fd51f9.tar.gz
fatcat-cli-658401529378bf7bdc6747ae1745d76732fd51f9.zip
allow editgroup_id to be supplied with 'editgroup_' prefix
Diffstat (limited to 'fatcat-cli/src/main.rs')
-rw-r--r--fatcat-cli/src/main.rs28
1 files changed, 14 insertions, 14 deletions
diff --git a/fatcat-cli/src/main.rs b/fatcat-cli/src/main.rs
index fd04044..b8b3865 100644
--- a/fatcat-cli/src/main.rs
+++ b/fatcat-cli/src/main.rs
@@ -83,17 +83,17 @@ enum EditgroupsCommand {
/// Accept (merge) a single editgroup
Accept {
#[structopt(env = "FATCAT_EDITGROUP", hide_env_values = true)]
- editgroup_id: String,
+ editgroup_id: EditgroupSpecifier,
},
/// Submit a single editgroup for review
Submit {
#[structopt(env = "FATCAT_EDITGROUP", hide_env_values = true)]
- editgroup_id: String,
+ editgroup_id: EditgroupSpecifier,
},
/// Un-submit a single editgroup (for more editing)
Unsubmit {
#[structopt(env = "FATCAT_EDITGROUP", hide_env_values = true)]
- editgroup_id: String,
+ editgroup_id: EditgroupSpecifier,
},
}
@@ -177,7 +177,7 @@ enum Command {
env = "FATCAT_EDITGROUP",
hide_env_values = true
)]
- editgroup_id: String,
+ editgroup_id: EditgroupSpecifier,
},
/// Update an existing editgroup, either from file or updating specified fields
@@ -194,7 +194,7 @@ enum Command {
env = "FATCAT_EDITGROUP",
hide_env_values = true
)]
- editgroup_id: String,
+ editgroup_id: EditgroupSpecifier,
mutations: Vec<Mutation>,
},
@@ -209,7 +209,7 @@ enum Command {
env = "FATCAT_EDITGROUP",
hide_env_values = true
)]
- editgroup_id: String,
+ editgroup_id: EditgroupSpecifier,
},
/// Use a text editor to update entity; fetches and uploads automatically
@@ -222,7 +222,7 @@ enum Command {
env = "FATCAT_EDITGROUP",
hide_env_values = true
)]
- editgroup_id: String,
+ editgroup_id: EditgroupSpecifier,
#[structopt(long)]
json: bool,
@@ -396,7 +396,7 @@ fn run(opt: Opt) -> Result<()> {
editgroup_id,
} => {
let json_str = read_entity_file(input_path)?;
- let ee = api_client.create_entity_from_json(entity_type, &json_str, editgroup_id)?;
+ let ee = api_client.create_entity_from_json(entity_type, &json_str, editgroup_id.as_string())?;
writeln!(&mut std::io::stdout(), "{}", to_colored_json_auto(&serde_json::to_value(&ee)?)?)?
}
Command::Update {
@@ -420,7 +420,7 @@ fn run(opt: Opt) -> Result<()> {
}
};
let ee =
- api_client.update_entity_from_json(exact_specifier, &json_str, editgroup_id)?;
+ api_client.update_entity_from_json(exact_specifier, &json_str, editgroup_id.as_string())?;
writeln!(&mut std::io::stdout(), "{}", to_colored_json_auto(&serde_json::to_value(&ee)?)?)?
}
Command::Edit {
@@ -433,7 +433,7 @@ fn run(opt: Opt) -> Result<()> {
let ee = edit_entity_locally(
&mut api_client,
specifier,
- editgroup_id,
+ editgroup_id.as_string(),
json,
editing_command,
)?;
@@ -645,7 +645,7 @@ fn run(opt: Opt) -> Result<()> {
editgroup_id,
} => {
let result = api_client
- .delete_entity(specifier.clone(), editgroup_id)
+ .delete_entity(specifier.clone(), editgroup_id.as_string())
.with_context(|| format!("delete entity: {:?}", specifier))?;
println!("{}", serde_json::to_string(&result)?);
}
@@ -721,19 +721,19 @@ fn run(opt: Opt) -> Result<()> {
Command::Editgroups {
cmd: EditgroupsCommand::Accept { editgroup_id },
} => {
- let msg = api_client.accept_editgroup(editgroup_id.clone())?;
+ let msg = api_client.accept_editgroup(editgroup_id.as_string())?;
writeln!(&mut std::io::stdout(), "{}", to_colored_json_auto(&serde_json::to_value(&msg)?)?)?
}
Command::Editgroups {
cmd: EditgroupsCommand::Submit { editgroup_id },
} => {
- let msg = api_client.update_editgroup_submit(editgroup_id, true)?;
+ let msg = api_client.update_editgroup_submit(editgroup_id.as_string(), true)?;
writeln!(&mut std::io::stdout(), "{}", to_colored_json_auto(&serde_json::to_value(&msg)?)?)?
}
Command::Editgroups {
cmd: EditgroupsCommand::Unsubmit { editgroup_id },
} => {
- let msg = api_client.update_editgroup_submit(editgroup_id, false)?;
+ let msg = api_client.update_editgroup_submit(editgroup_id.as_string(), false)?;
writeln!(&mut std::io::stdout(), "{}", to_colored_json_auto(&serde_json::to_value(&msg)?)?)?
}
Command::Status { json } => {