Skip to content
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

Add manpage generation using xtask. #1059

Merged
merged 5 commits into from
Mar 6, 2023
Merged

Conversation

ThomasFrans
Copy link
Contributor

This commit introduces semi-automatic manpage generation using the xtask workflow. This automates generation of manpages using the provided clap Command struct. I only wanted to suggest it for now, so I'm making it a draft.

@hrkfdn
Copy link
Owner

hrkfdn commented Mar 1, 2023

Hey again! Thanks for the PR, I really like the idea. I'm wondering if there is a way to reuse the Clap Command setup from the main project so that we don't have to maintain two instances of it?

Also, I guess the configuration is more complex than the command line arguments, so a manpage for that or having it as part of the ncspot manpage would be cool. I have looked at the clap_mangen docs but it seems that this is not possible unless we can somehow add it to the Clap Command.

@ThomasFrans
Copy link
Contributor Author

ThomasFrans commented Mar 1, 2023

Agreed, I think having a manpage for configuration would be a big improvement. I also thought about having the double instances of the clap command, and I think by making a library for ncspot (src/lib.rs) and putting it in there as a public static or const could help with that. Then both parts of the code could use it as if ncspot was a library.

I'll work on this further when I have some time 🙂

This changes the default behavior of the `cargo run` command for xtasks
to hide the compilation info. This makes sense as xtask's are run as a
program, and showing the compilation info every time clutters stdout
with unrelated info.
Moving the `clap::Command` used internally by ncspot to a library allows
it to be easily shared between different packages (xtask and ncspot
itself).

This commit also reworks the xtasks to use clap for parsing the xtask
arguments, which simplifies writing new xtasks.
When more xtasks get added, it would make sense to have a `generate-all`
subcommand that executes all xtasks, which wouldn't be able to have
options for every separate subcommand. Therefore the `output` argument
should be optional, and by default output to the `misc` directory which
contains extra metadata files already.
Update the README to include information for packagers. The information
includes provided files as well as info on how to generate some of them.
@ThomasFrans
Copy link
Contributor Author

With this commit, I think the man page generation using xtask could be ready. It doesn't include the configuration information as I think it would make more sense to provide this information the same way Alacritty and some other programs do, using a default configuration file with added comments that explain the purpose of each option (I could make a separate PR for that). If adding the configuration to the man page would be preferred over the 'default configuration' approach, I'll happily add it.

I also added a bit of info about the provided metadata files to the README for packaging ncspot. I hope that's ok.

@ThomasFrans ThomasFrans marked this pull request as ready for review March 3, 2023 16:08
@hrkfdn hrkfdn merged commit b27e84a into hrkfdn:main Mar 6, 2023
@hrkfdn
Copy link
Owner

hrkfdn commented Mar 6, 2023

Very cool, merged. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants