-
Notifications
You must be signed in to change notification settings - Fork 29
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
1 parent
2c68f76
commit de8ef8b
Showing
6 changed files
with
76 additions
and
6 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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,25 @@ | ||
use clap_mangen::Man; | ||
use std::fs::{create_dir_all, File}; | ||
use std::path::Path; | ||
use std::sync::Arc; | ||
|
||
pub fn generate_manual(cmd: clap::Command, out: &Path) -> Result<(), Box<dyn std::error::Error>> { | ||
create_dir_all(out)?; | ||
|
||
Man::new(cmd.clone()).render(&mut File::create(out.join("typst-ts-cli.1")).unwrap())?; | ||
|
||
let mut borrow_str = vec![]; | ||
|
||
for subcmd in cmd.get_subcommands() { | ||
let name: Arc<str> = format!("typst-ts-cli-{}", subcmd.get_name()).into(); | ||
Man::new( | ||
subcmd | ||
.clone() | ||
.name(unsafe { std::mem::transmute::<&str, &'static str>(name.as_ref()) }), | ||
) | ||
.render(&mut File::create(out.join(format!("{name}.1")))?)?; | ||
borrow_str.push(name); | ||
} | ||
|
||
Ok(()) | ||
} |