From 6fe17c0e063cbe07e6405fce2ce230fc26374ff9 Mon Sep 17 00:00:00 2001 From: Glen Choo Date: Mon, 21 Nov 2022 16:18:27 -0800 Subject: [PATCH] cli: paginate help This does not respect "--no-pager", support will be added in the next commit. --- src/cli_util.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/cli_util.rs b/src/cli_util.rs index 40e7a6e8bc..59bbc42935 100644 --- a/src/cli_util.rs +++ b/src/cli_util.rs @@ -1457,6 +1457,13 @@ pub fn handle_command_result(ui: &mut Ui, result: Result<(), CommandError>) -> i inner.render().to_string() }; + match inner.kind() { + clap::error::ErrorKind::DisplayHelp + | clap::error::ErrorKind::DisplayHelpOnMissingArgumentOrSubcommand => { + ui.request_pager() + } + _ => {} + }; // Definitions for exit codes and streams come from // https://github.com/clap-rs/clap/blob/master/src/error/mod.rs match inner.kind() {