-
-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BuildSystem] Scdoc generation with build.rs
Signed-off-by: Shinyzenith <[email protected]>
- Loading branch information
1 parent
6bac416
commit 5bb8ebe
Showing
6 changed files
with
51 additions
and
30 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
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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
use std::{fs::read_dir, io::ErrorKind, process::exit, process::Command}; | ||
|
||
fn main() { | ||
// Check if scdoc command exists | ||
match Command::new("scdoc").spawn() { | ||
Err(e) => { | ||
if let ErrorKind::NotFound = e.kind() { | ||
exit(0); | ||
} | ||
} | ||
_ => {} | ||
} | ||
|
||
let mut man_pages: Vec<(String, String)> = Vec::new(); | ||
for path in read_dir("./docs").unwrap() { | ||
let path = path.unwrap(); | ||
if path.file_type().unwrap().is_dir() { | ||
continue; | ||
} | ||
|
||
if let Some(file_name) = path.path().to_str() { | ||
let man_page_name = file_name.replace(".scd", ".gz"); | ||
man_pages.push((file_name.to_string(), man_page_name)); | ||
} | ||
} | ||
|
||
for man_page in man_pages { | ||
_ = Command::new("sh") | ||
.arg("-c") | ||
.arg(format!("scdoc <{}>{}", man_page.0, man_page.1)) | ||
.spawn(); | ||
} | ||
} |
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