diff options
author | Ben Morrison <ben@gbmor.dev> | 2019-09-04 13:52:44 -0400 |
---|---|---|
committer | Ben Morrison <ben@gbmor.dev> | 2019-09-04 13:52:44 -0400 |
commit | c0ce5eff2797dd7e5652fd15594f170cd90d8ac9 (patch) | |
tree | 9996f3db059672a704f9b9942c4e67d7867bbb30 /src/posts.rs | |
parent | 8e3e31ee2b6721ed4ccb958fefec1431372e39ba (diff) | |
download | clinte-c0ce5eff2797dd7e5652fd15594f170cd90d8ac9.tar.gz |
now opens $EDITOR to write post body
Diffstat (limited to 'src/posts.rs')
-rw-r--r-- | src/posts.rs | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/posts.rs b/src/posts.rs index 27327ff..cb546ef 100644 --- a/src/posts.rs +++ b/src/posts.rs @@ -4,6 +4,7 @@ use std::io; use rusqlite; use crate::db; +use crate::ed; use crate::user; type Result<T> = std::result::Result<T, Box<dyn Error>>; @@ -50,10 +51,7 @@ pub fn create(db: &db::Conn) { }; println!(); - println!("Body of the new post: "); - let mut body = String::new(); - io::stdin().read_line(&mut body).unwrap(); - let body = str_to_utf8(body.trim()); + let body = str_to_utf8(&ed::call()); let body = if body.len() > 500 { &body[..500] } else { |