-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
2,196 additions
and
1,256 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
Cargo.lock linguist-generated=true | ||
flake.lock linguist-generated=true | ||
|
||
tests/** linguist-generated=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,26 @@ | ||
use regex::Regex; | ||
use regex::{Regex, RegexBuilder}; | ||
|
||
fn parse(s: &str) -> Option<()> { | ||
match s.find("\nOPTIONS") { | ||
Some(options_header) => { | ||
let re = Regex::new("").unwrap(); | ||
use crate::result::Result; | ||
|
||
use super::CommandInfo; | ||
|
||
/// Regex to get the contents of a section with the given title | ||
fn regex_for_section(title: &str) -> Regex { | ||
RegexBuilder::new(&format!(r#"\.SH {title}(.*?)(\.SH|\z)"#)) | ||
.multi_line(true) | ||
.dot_matches_new_line(true) | ||
.build() | ||
.unwrap() | ||
} | ||
|
||
pub fn parse(cmd_name: &str, page_text: &str) -> Result<Option<CommandInfo>> { | ||
let re = regex_for_section(r#""OPTIONS""#); | ||
match re.captures(page_text) { | ||
Some(captures) => { | ||
let content = captures.get(1).unwrap().as_str(); | ||
println!("{}", content); | ||
todo!() | ||
} | ||
None => None | ||
None => Ok(None), | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.