Skip to content

Commit

Permalink
cli: paginate help
Browse files Browse the repository at this point in the history
This does not respect "--no-pager", support will be added in the next
commit.
  • Loading branch information
chooglen committed Nov 30, 2022
1 parent f30a922 commit 6fe17c0
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/cli_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit 6fe17c0

Please sign in to comment.