pub fn add_note(
        &mut self,
        title: &String,
        body: &Vec<String>,
        started: bool,
        urgent: bool,
        use_stdin: bool,
        use_editor: bool,
        print_msg: bool
    ) -> Result<(), ThecaError> {
        let title = title.replace("\n", "").to_string();
        let status = if started {
            STARTED.to_string()
        } else if urgent {
            URGENT.to_string()
        } else {
            NOSTATUS.to_string()
        };

        let body = match use_stdin {
            false => match use_editor {
                false => match body.is_empty() {
                    true => "".to_string(),
                    false => body[0].clone(),
                },
                true => {
                    match istty(STDOUT_FILENO) && istty(STDIN_FILENO) {
                        true => try!(drop_to_editor(&"".to_string())),
                        false => "".to_string()
                    }
                }
            },
            true => { try!(stdin().read_to_string()) }
        };

        let new_id = match self.notes.last() {
            Some(n) => n.id,
            None => 0
        };
        self.notes.push(ThecaItem {
            id: new_id + 1,
            title: title,
            status: status,
            body: body,
            last_touched: try!(strftime(DATEFMT, &now()))
        });
        if print_msg { println!("note {} added", new_id+1); }
        Ok(())
    }
/// add a item to the profile
add a item to the profile
add a item to the profile
pub fn add_note(
        &mut self,
        title: &String,
        body: &Vec<String>,
        started: bool,
        urgent: bool,
        use_stdin: bool,
        use_editor: bool,
        print_msg: bool
    ) -> Result<(), ThecaError> {
        let title = title.replace("\n", "").to_string();
        let status = if started {
            STARTED.to_string()
        } else if urgent {
            URGENT.to_string()
        } else {
            NOSTATUS.to_string()
        };
        let body = match use_stdin {
            false => match use_editor {
                false => match body.is_empty() {
                    true => "".to_string(),
                    false => body[0].clone(),
                },
                true => {
                    match istty(STDOUT_FILENO) && istty(STDIN_FILENO) {
                        true => try!(drop_to_editor(&"".to_string())),
                        false => "".to_string()
                    }
                }
            },
            true => { try!(stdin().read_to_string()) }
        };
        let new_id = match self.notes.last() {
            Some(n) => n.id,
            None => 0
        };
        self.notes.push(ThecaItem {
            id: new_id + 1,
            title: title,
            status: status,
            body: body,
            last_touched: try!(strftime(DATEFMT, &now()))
        });
        if print_msg { println!("note {} added", new_id+1); }
        Ok(())
    }
pub fn add_note ( & mut self , title : & String , body : & Vec < String > , started : bool , urgent : bool , use_stdin : bool , use_editor : bool , print_msg : bool ) -> Result < ( ) , ThecaError > { let title = title . replace ( " \n " , " " ) . to_string ( ) ; let status = if started { STARTED . to_string ( ) } else if urgent { URGENT . to_string ( ) } else { NOSTATUS . to_string ( ) } ; let body = match use_stdin { false => match use_editor { false => match body . is_empty ( ) { true => " " . to_string ( ) , false => body [ 0 ] . clone ( ) , } , true => { match istty ( STDOUT_FILENO ) && istty ( STDIN_FILENO ) { true => try ! ( drop_to_editor ( " " to_string ( ) ) ) , false => " " . to_string ( ) } } } , true => { try ! ( stdin ( ) read_to_string ( ) ) } } ; let new_id = match self . notes . last ( ) { Some ( n ) => n . id , None => 0 } ; self . notes . push ( ThecaItem { id : new_id + 1 , title : title , status : status , body : body , last_touched : try ! ( strftime ( DATEFMT now ( ) ) ) } ) ; if print_msg { println ! ( " " new_id 1 ) ; } Ok ( ( ) ) }
add a item to the profile
add a item to the profile
&mut self
title
&String
body
&Vec<String>
started
bool
urgent
bool
use_stdin
bool
use_editor
bool
print_msg
bool
&mut self
title
&String
body
&Vec<String>
started
bool
urgent
bool
use_stdin
bool
use_editor
bool
print_msg
bool