fix: missing automatic man page generation for subcommands

The main man page would point to man pages for subcommands, which
weren't created automatically by the man page xtask.
This commit is contained in:
Thomas Frans
2024-11-01 16:55:41 +01:00
committed by Henrik Friedrichsen
parent 4c609bc4e6
commit 56b4fab79c
3 changed files with 10 additions and 6 deletions

View File

@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
### Fixed
- Missing automatic man page generation for subcommands
## [1.2.1] - 2024-10-31 ## [1.2.1] - 2024-10-31
### Fixed ### Fixed
@@ -215,6 +221,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Albums with more than 50 songs not showing all the songs when viewed in the library - Albums with more than 50 songs not showing all the songs when viewed in the library
- Bug that could cause items to not load until the screen is filled on bigger screens - Bug that could cause items to not load until the screen is filled on bigger screens
[Unreleased]: https://github.com/hrkfdn/ncspot/compare/v1.2.1...HEAD
[1.2.1]: https://github.com/hrkfdn/ncspot/compare/v1.2.0...v1.2.1 [1.2.1]: https://github.com/hrkfdn/ncspot/compare/v1.2.0...v1.2.1
[1.2.0]: https://github.com/hrkfdn/ncspot/compare/v1.1.2...v1.2.0 [1.2.0]: https://github.com/hrkfdn/ncspot/compare/v1.1.2...v1.2.0
[1.1.2]: https://github.com/hrkfdn/ncspot/compare/v1.1.1...v1.1.2 [1.1.2]: https://github.com/hrkfdn/ncspot/compare/v1.1.1...v1.1.2

View File

@@ -18,7 +18,7 @@ generated. Execute `cargo xtask --help` for more information.
- LICENSE - LICENSE
- images/logo.svg (optional) - images/logo.svg (optional)
- misc/ncspot.desktop (for Linux systems) - misc/ncspot.desktop (for Linux systems)
- misc/ncspot.1 (for Linux systems) - misc/*.1 (for Linux systems)
- misc/ncspot.bash (bash completions) - misc/ncspot.bash (bash completions)
- misc/\_ncspot (zsh completions) - misc/\_ncspot (zsh completions)
- misc/ncspot.fish (fish completions) - misc/ncspot.fish (fish completions)

View File

@@ -61,7 +61,7 @@ automation.",
.long("output") .long("output")
.value_name("PATH") .value_name("PATH")
.default_value("misc") .default_value("misc")
.help("Output directory for the generated man page.") .help("Output directory for the generated man pages.")
.value_parser(PathBufValueParser::new())]) .value_parser(PathBufValueParser::new())])
.about("Automatic man page generation."), .about("Automatic man page generation."),
clap::Command::new("generate-shell-completion") clap::Command::new("generate-shell-completion")
@@ -110,15 +110,12 @@ fn generate_manpage(subcommand_arguments: &ArgMatches) -> Result<(), DynError> {
.get_one::<PathBuf>("output") .get_one::<PathBuf>("output")
.unwrap_or(&default_output_directory); .unwrap_or(&default_output_directory);
let cmd = ncspot::program_arguments(); let cmd = ncspot::program_arguments();
let man = clap_mangen::Man::new(cmd);
let mut buffer: Vec<u8> = Default::default();
if *output_directory == default_output_directory { if *output_directory == default_output_directory {
fs::create_dir_all(DEFAULT_OUTPUT_DIRECTORY)?; fs::create_dir_all(DEFAULT_OUTPUT_DIRECTORY)?;
} }
man.render(&mut buffer)?; clap_mangen::generate_to(cmd, output_directory)?;
std::fs::write(output_directory.join("ncspot.1"), buffer)?;
Ok(()) Ok(())
} }