pub fn read_from_file(path: &str) -> AnyhowResult<String> {
    use std::io::Read;
    let mut content = String::new();
    if path == "-" {
        std::io::stdin().read_to_string(&mut content)?;
    } else {
        let path = std::path::Path::new(&path);
        let mut file =
            std::fs::File::open(&path).map_err(|_| anyhow!("Message file doesn't exist"))?;
        file.read_to_string(&mut content)
            .map_err(|_| anyhow!("Cannot read the message file."))?;
    }
    Ok(content)
}
/// Reads from the file path or STDIN and returns the content.
Reads from the file path or STDIN and returns the content.
Reads from the file path or STDIN and returns the content .
pub fn read_from_file(path: &str) -> AnyhowResult<String> {
    use std::io::Read;
    let mut content = String::new();
    if path == "-" {
        std::io::stdin().read_to_string(&mut content)?;
    } else {
        let path = std::path::Path::new(&path);
        let mut file =
            std::fs::File::open(&path).map_err(|_| anyhow!("Message file doesn't exist"))?;
        file.read_to_string(&mut content)
            .map_err(|_| anyhow!("Cannot read the message file."))?;
    }
    Ok(content)
}
pub fn read_from_file ( path : & str ) -> AnyhowResult < String > { use std :: io :: Read ; let mut content = String :: new ( ) ; if path == " " { std :: io :: stdin ( ) . read_to_string ( & mut content ) ? ; } else { let path = std :: path :: Path :: new ( & path ) ; let mut file = std :: fs :: File :: open ( & path ) . map_err ( | _ | anyhow ! ( " " ) ) ? ; file . read_to_string ( & mut content ) . map_err ( | _ | anyhow ! ( " " ) ) ? ; } Ok ( content ) }
Reads from the file path or STDIN and returns the content.
Reads from the file path or STDIN and returns the content .
path
&str