WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ rand = "0.8.3"

# CLI specific dependencies
magic-wormhole = { path = "..", version = "0.7", features = ["all"] }
clap_mangen = { version = "0.2", optional = true }
clap = { version = "4", features = ["cargo", "derive", "help"] }
clap_complete = "4"
env_logger = "0.11"
Expand Down Expand Up @@ -57,3 +58,4 @@ experimental = ["experimental-transfer-v2"]

default = ["magic-wormhole/default", "magic-wormhole/forwarding"]
all = ["default", "magic-wormhole/native-tls"]
generate-manpage = ["dep:clap_mangen"]
24 changes: 22 additions & 2 deletions cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,12 +225,19 @@ enum WormholeCommand {
},
#[command(hide = true)]
Help,
/// Generate the manual pages for this project
#[cfg(feature = "generate-manpage")]
#[command(name = "generate-manpage", hide = true)]
GenerateManpage {
/// The path of the manpage
path: PathBuf,
},
}

#[derive(Debug, Parser)]
#[command(
version,
author,
author = "The wormhole-rs developers",
about,
arg_required_else_help = true,
disable_help_subcommand = true,
Expand All @@ -249,7 +256,7 @@ struct WormholeCli {
display_order = 100
)]
log: bool,
#[clap(subcommand)]
#[command(subcommand)]
command: WormholeCommand,
}

Expand Down Expand Up @@ -546,6 +553,19 @@ async fn main() -> eyre::Result<()> {
println!("Use --help to get help");
std::process::exit(2);
},
#[cfg(feature = "generate-manpage")]
WormholeCommand::GenerateManpage { path } => {
println!("Generating manpage as {}", path.canonicalize()?.display());

let cmd = WormholeCli::command();
let man = clap_mangen::Man::new(cmd)
.section("1")
.date("Jul 2024")
.manual("User Commands");

let mut file = std::fs::File::create(path)?;
man.render(&mut file)?;
},
}

Ok(())
Expand Down
47 changes: 0 additions & 47 deletions wormhole.1

This file was deleted.