added a flag to config for setting terminal title

This commit is contained in:
Oliver looney 2024-01-27 14:14:40 +00:00
parent b4fdb5dc36
commit 9239b125b1
No known key found for this signature in database
3 changed files with 10 additions and 0 deletions

View File

@ -287,6 +287,7 @@ impl App {
use_custom_assets: !self.matches.get_flag("no-custom-assets"),
#[cfg(feature = "lessopen")]
use_lessopen: self.matches.get_flag("lessopen"),
set_terminal_title: self.matches.get_flag("set_terminal_title"),
})
}

View File

@ -168,6 +168,12 @@ pub fn build_app(interactive_output: bool) -> Command {
"Include N lines of context around added/removed/modified lines when using '--diff'.",
),
)
.arg(
Arg::new("set_terminal_title")
.long("set_terminal_title")
.action(ArgAction::SetTrue)
.help("Sets terminal title when using a pager")
.long_help("Sets terminal title to filenames when using a pager."),)
}
app = app.arg(

View File

@ -94,6 +94,9 @@ pub struct Config<'a> {
// Whether or not to use $LESSOPEN if set
#[cfg(feature = "lessopen")]
pub use_lessopen: bool,
// Weather or not to set terminal title when using a pager
pub set_terminal_title: bool,
}
#[cfg(all(feature = "minimal-application", feature = "paging"))]