aboutsummaryrefslogtreecommitdiff
path: root/crates/cli/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/cli/src')
-rw-r--r--crates/cli/src/words.rs12
1 files changed, 11 insertions, 1 deletions
diff --git a/crates/cli/src/words.rs b/crates/cli/src/words.rs
index e7aadcb..a54e679 100644
--- a/crates/cli/src/words.rs
+++ b/crates/cli/src/words.rs
@@ -599,15 +599,25 @@ fn dup(mut args: IntoIter<String>) -> i32 {
return 1;
};
- // Create the word, set it as an alternative, and attach the given tags.
+ // Create the word. If successful, then we move into relationships and tags.
match mihi::create_word(updated) {
Ok(word_id) => {
+ // Set it as an alternative. This goes both ways, so two
+ // relationships have to be inserted with both directions.
if let Err(e) =
mihi::add_word_relationship(source_id, word_id, RelationKind::Alternative)
{
println!("errors: words: {e}.");
return 1;
}
+ if let Err(e) =
+ mihi::add_word_relationship(word_id, source_id, RelationKind::Alternative)
+ {
+ println!("errors: words: {e}.");
+ return 1;
+ }
+
+ // Attach tags.
for tag in selected_tags {
if let Err(e) = mihi::attach_tag_to_word(tag.id as i64, word_id) {
println!("warning: words: {e}.");