pub fn extract_help_from_content(content: &str) -> impl Iterator<Item = &str>
Examples found in repository?
src/list/mod.rs (line 37)
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
fn extract_help(script: &ScriptInfo) -> String {
    let mut buff = String::new();
    fn inner(buff: &mut String, script: &ScriptInfo) -> Result {
        let script_path = crate::path::open_script(&script.name, &script.ty, Some(true))?;
        *buff = crate::util::read_file(&script_path)?;
        Ok(())
    }
    match inner(&mut buff, script) {
        Err(e) => {
            log::warn!("讀取腳本失敗{},直接回空的幫助字串", e);
            return String::new();
        }
        Ok(()) => (),
    };
    let mut helps = crate::extract_msg::extract_help_from_content(&buff);
    helps.next().unwrap_or_default().to_owned()
}