-
Couldn't load subscription status.
- Fork 46
Provide manpages #921
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide manpages #921
Conversation
|
There are a few rough edges with
Here is the non-pre/post-processed output, for reference: |
|
Honestly, I'm not sure the book is what people want/expect to read in the man pages. Which probably explains (in part) why the tool you're using doesn't really work well with it. |
I'm not using the whole book; I've taken a subset which just covers the usage and configuration of the Topiary CLI. |
391a792 to
73937f3
Compare
245b7c2 to
c71f8f8
Compare
|
Pre- and post-processing code is [finally] complete 🎉 This is what it spits out now: topiary.1.gz |
54ea987 to
7b83a09
Compare
The problem was due to mismatched versions of mdbook-man on GitHub vs. crates.io. The Nix derivation uses the GitHub version, but building manually with crates.io will fail. Until upstream has corrected this problem -- which isn't likely any time soon -- the best I can do is document a working manual install for non-Nix users.
Otherwise, this has been pending for 3 months, so I'm forcing it through!
|
Have you looked into diff --git a/topiary-cli/Cargo.toml b/topiary-cli/Cargo.toml
index 4bf6bb6..02ea3d8 100644
--- a/topiary-cli/Cargo.toml
+++ b/topiary-cli/Cargo.toml
@@ -28,6 +28,7 @@ path = "src/main.rs"
async-scoped = { workspace = true }
clap = { workspace = true, features = ["derive", "env", "wrap_help"] }
clap_complete = { workspace = true }
+clap_mangen = "0.2.29"
env_logger = { workspace = true }
futures = { workspace = true }
itertools = { workspace = true }
diff --git a/topiary-cli/src/cli.rs b/topiary-cli/src/cli.rs
index fe87bb2..8dca38a 100644
--- a/topiary-cli/src/cli.rs
+++ b/topiary-cli/src/cli.rs
@@ -176,6 +176,10 @@ pub enum Commands {
/// Shell (omit to detect from the environment)
shell: Option<Shell>,
},
+
+ /// Generate manpages
+ #[command(display_order = 100)]
+ Man,
}
/// Parse CLI arguments and normalise them for the caller
diff --git a/topiary-cli/src/main.rs b/topiary-cli/src/main.rs
index b360889..5cc00a5 100644
--- a/topiary-cli/src/main.rs
+++ b/topiary-cli/src/main.rs
@@ -15,7 +15,7 @@ use error::Benign;
use topiary_core::{check_query_coverage, formatter, Operation};
use crate::{
- cli::Commands,
+ cli::{Cli, Commands},
error::{CLIError, CLIResult, TopiaryError},
io::{read_input, Inputs, OutputFile},
language::LanguageDefinitionCache,
@@ -212,6 +212,9 @@ async fn run() -> CLIResult<()> {
// The CLI parser fails if no shell is provided/detected, so it's safe to unwrap here
cli::completion(shell.unwrap());
}
+
+ Commands::Man => clap_mangen::Man::new(<Cli as clap::CommandFactory>::command())
+ .render(&mut std::io::stdout())?,
}
Ok(())You can run |
|
Thanks for taking a look, @mkatychev 🙏 I agree that the spacing is a bit much...I'll have a look at |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with the BSD changes, lgtm
|
Thanks, @mkatychev 🙏 I haven't had the opportunity to look at |


Provide manpages
Resolves #806
Description
Convert the Topiary CLI section in the Topiary Book into manpages, for distribution with Topiary.
Checklist
Checklist before merging, wherever relevant:
CHANGELOG.mdupdatedREADME.md, etc.) up-to-date