Skip to content

Commit d5d8b14

Browse files
committed
Use exact match of id and title for remove snippet
1 parent f25829d commit d5d8b14

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

‎src/commands/snippets.rs‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,15 +144,16 @@ pub async fn remove_snippet(
144144
ctx: Context<'_>,
145145
#[autocomplete = "autocomplete_snippet"]
146146
#[description = "The snippet's id"]
147-
id: String,
147+
#[rename = "id"]
148+
id_and_title: String,
148149
) -> Result<(), Error> {
149-
match get_snippet_lazy(&ctx, &id) {
150+
match get_snippet(&ctx, &id_and_title) {
150151
Some(snippet) => {
151152
remove_snippet_confirm(&ctx, &snippet).await?;
152153
}
153154
None => {
154155
let title = &"Failed to remove snippet";
155-
let content = &&format!("The snippet '{id}' does not exist");
156+
let content = &&format!("The snippet '{id_and_title}' does not exist");
156157
respond_err(&ctx, title, content).await;
157158
}
158159
}

0 commit comments

Comments
 (0)