cli: Handle message editor corner cases
1. Split on double newline fails when description is empty 2. Title must be a single line
This commit is contained in:
parent
3ad2b4431f
commit
f0b8446515
|
|
@ -87,12 +87,13 @@ impl Message {
|
|||
placeholder.push_str(help);
|
||||
|
||||
let output = Self::Edit.get(&placeholder)?;
|
||||
let Some((title, description)) = output.split_once("\n\n") else {
|
||||
return Ok(None);
|
||||
let (title, description) = match output.split_once("\n\n") {
|
||||
Some((x, y)) => (x, y),
|
||||
None => (output.as_str(), ""),
|
||||
};
|
||||
let (title, description) = (title.trim(), description.trim());
|
||||
|
||||
if title.is_empty() {
|
||||
if title.is_empty() | title.contains('\n') {
|
||||
return Ok(None);
|
||||
}
|
||||
Ok(Some((title.to_owned(), description.to_owned())))
|
||||
|
|
|
|||
Loading…
Reference in New Issue