diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ecabc89..8c46cfe2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,8 +8,15 @@ To publish a new release run `scripts/release` from the project directory. ## [Unreleased] +### Added +- Generate completions for `mdless` (see [GH-216]). + ### Fixed - Include generated shell completions in release artifacts. +- Fix completions for mdcat (see [GH-214] and [GH-216]) + +[GH-214]: https://github.com/lunaryorn/mdcat/issues/214 +[GH-216]: https://github.com/lunaryorn/mdcat/pull/216 ## [0.29.0] – 2022-10-21 diff --git a/build.rs b/build.rs index 410840ed..2c49dd9c 100644 --- a/build.rs +++ b/build.rs @@ -18,14 +18,12 @@ fn gen_completions>(out_dir: P) -> Result<()> { let completions = out_dir.as_ref().join("completions"); std::fs::create_dir_all(&completions).expect("Failed to create $OUT_DIR/completions"); - - for shell in [Shell::Bash, Shell::Zsh, Shell::Fish, Shell::PowerShell] { - generate_to( - shell, - &mut mdcat::Args::command(), - "mdcat", - &completions - )?; + for program in ["mdcat", "mdless"] { + let mut command = mdcat::Args::command(); + let subcommand = command.find_subcommand_mut(program).unwrap(); + for shell in [Shell::Bash, Shell::Zsh, Shell::Fish, Shell::PowerShell] { + generate_to(shell, subcommand, program, &completions)?; + } } Ok(()) diff --git a/src/bin/mdcat/args.rs b/src/bin/mdcat/args.rs index e48c0ed7..503439b4 100644 --- a/src/bin/mdcat/args.rs +++ b/src/bin/mdcat/args.rs @@ -25,7 +25,7 @@ You can obtain one at http://mozilla.org/MPL/2.0/." } #[derive(Debug, clap::Parser)] -#[command(multicall = true)] +#[command(multicall = true, arg_required_else_help = true, subcommand_required = true)] pub struct Args { #[command(subcommand)] pub command: Command,