diff options
author | Ben Morrison <ben@gbmor.dev> | 2020-05-26 23:27:58 -0400 |
---|---|---|
committer | Ben Morrison <ben@gbmor.dev> | 2020-05-26 23:54:18 -0400 |
commit | 896f987f2705d1c5152d6c0741c377e3612f048a (patch) | |
tree | f6ed5a1b861c9d3e7a2c474084bc4afb6384190a /src/posts.rs | |
parent | c3c1db696f3b04e4aef06fd2b01e436b1fe06b08 (diff) | |
download | clinte-896f987f2705d1c5152d6c0741c377e3612f048a.tar.gz |
prepopulating editor with post body when editing
Diffstat (limited to 'src/posts.rs')
-rw-r--r-- | src/posts.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/posts.rs b/src/posts.rs index f625a90..76a5187 100644 --- a/src/posts.rs +++ b/src/posts.rs @@ -51,7 +51,7 @@ pub fn create(db: &db::Conn) -> error::Result<()> { println!(); - let body_raw = str_to_utf8(&ed::call()); + let body_raw = str_to_utf8(&ed::call("")); let body = if body_raw.len() > 500 { &body_raw[..500] } else { @@ -136,12 +136,12 @@ pub fn update_handler(db: &db::Conn, id: u32) -> error::Result<()> { println!("Updating post {}", id_num_in); println!(); - println!("Title: {}\n\nBody: {}", row[0], row[2]); + println!("Current Title: {}", &row[0]); println!(); println!("Enter new title:"); io::stdin().read_line(&mut new_title)?; - let body_raw = str_to_utf8(&ed::call()); + let body_raw = str_to_utf8(&ed::call(&row[2])); let body = if body_raw.len() > 500 { &body_raw[..500] } else { |