add gen manpage

This commit is contained in:
MedzikUser 2022-03-09 18:39:33 +01:00
parent b6e911ffb5
commit 488f05704f
No known key found for this signature in database
GPG Key ID: A5FAC1E185C112DB
5 changed files with 35 additions and 1 deletions

View File

@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
<!-- next-header -->
## [Unreleased]
- added manpage
## [0.2.0] - 2022-03-09
### CLI

17
Cargo.lock generated
View File

@ -116,6 +116,16 @@ dependencies = [
"syn",
]
[[package]]
name = "clap_mangen"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0649fb4156bbd7306896025005596033879a2051f9a3aa7416ab915df1f8fdac"
dependencies = [
"clap",
"roff",
]
[[package]]
name = "colored"
version = "2.0.0"
@ -170,6 +180,7 @@ dependencies = [
"better-panic",
"clap",
"clap_complete",
"clap_mangen",
"colored",
"ctrlc",
"discord-rich-presence",
@ -361,6 +372,12 @@ dependencies = [
"proc-macro2",
]
[[package]]
name = "roff"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b833d8d034ea094b1ea68aa6d5c740e0d04bad9d16568d08ba6f76823a114316"
[[package]]
name = "rustc-demangle"
version = "0.1.21"

View File

@ -22,6 +22,7 @@ clap_complete = "3.1.1"
colored = "2.0.0"
discord-rich-presence = "0.2.0"
ctrlc = "3.2.1"
clap_mangen = "0.1.2"
[dependencies.clap]
version = "3.1.6"

View File

@ -137,4 +137,10 @@ pub struct Cli {
display_order = 14
)]
pub print_completions: Option<Shell>,
#[clap(
long = "print-manpage",
display_order = 15
)]
pub manpage: bool,
}

View File

@ -19,7 +19,7 @@ fn main() {
let args = Cli::parse();
// * print_completions
// * print completions
if let Some(shell) = args.print_completions {
let mut clap_app = Cli::command();
let app_name = clap_app.get_name().to_string();
@ -28,6 +28,15 @@ fn main() {
exit(0)
}
// * print manpage
if args.manpage {
let clap_app = Cli::command();
let man = clap_mangen::Man::new(clap_app);
man.render(&mut io::stdout()).expect("generate manpage");
exit(0)
}
// * start discord rpc
execute::run(args.clone());