Skip to content

Commit

Permalink
fix: missing automatic man page generation for subcommands
Browse files Browse the repository at this point in the history
The main man page would point to man pages for subcommands, which
weren't created automatically by the man page xtask.
  • Loading branch information
ThomasFrans authored and hrkfdn committed Nov 9, 2024
1 parent 4c609bc commit 56b4fab
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/),
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

### Fixed
Expand Down Expand Up @@ -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
- 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.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
Expand Down
2 changes: 1 addition & 1 deletion doc/package_maintainers.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ generated. Execute `cargo xtask --help` for more information.
- LICENSE
- images/logo.svg (optional)
- misc/ncspot.desktop (for Linux systems)
- misc/ncspot.1 (for Linux systems)
- misc/*.1 (for Linux systems)
- misc/ncspot.bash (bash completions)
- misc/\_ncspot (zsh completions)
- misc/ncspot.fish (fish completions)
Expand Down
7 changes: 2 additions & 5 deletions xtask/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ automation.",
.long("output")
.value_name("PATH")
.default_value("misc")
.help("Output directory for the generated man page.")
.help("Output directory for the generated man pages.")
.value_parser(PathBufValueParser::new())])
.about("Automatic man page generation."),
clap::Command::new("generate-shell-completion")
Expand Down Expand Up @@ -110,15 +110,12 @@ fn generate_manpage(subcommand_arguments: &ArgMatches) -> Result<(), DynError> {
.get_one::<PathBuf>("output")
.unwrap_or(&default_output_directory);
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 {
fs::create_dir_all(DEFAULT_OUTPUT_DIRECTORY)?;
}

man.render(&mut buffer)?;
std::fs::write(output_directory.join("ncspot.1"), buffer)?;
clap_mangen::generate_to(cmd, output_directory)?;

Ok(())
}
Expand Down

0 comments on commit 56b4fab

Please sign in to comment.