pager function respects cli option and user config files, PAGER env var
Dependencies
- [2]
JRFPXWIDChecking whether the output is a tty is done before checking whether the pager was on, so colours were wrong for some setups - [3]
6U42MTEZFixing log -- filters, along with performance improvements - [4]
FDEVV5NGTag check - [5]
CCLLB7OIUpgrading to Sanakirja 0.15 + version bump - [6]
5YDI33C4Fixing pager on OSX - [7]
I24UEJQLVarious post-fire fixes - [8]
SMMBFECLConverting to the new patch format "online" - [9]
5BB266P6Optional colours in the global config file - [10]
EUZFFJSOUpdating Pijul with the latest changes in Libpijul - [11]
OU6JOR3CAdd path filtering for log, add json output for log - [12]
AAXP2534Tags: completing the subcommand - [13]
SXEYMYF7Fixing the bad changes in history (unfortunately, by rebooting). - [14]
GLRGFBCWChecking the version of less we have - [15]
SFJ3XRTFProper escaping of UTF-8 filenames in the patch text format - [16]
NAUECZW3Fixing the map between keys and identities - [17]
ZRUPLBBTColours in diff and change: separating concerns and dependencies - [18]
F2S6XETOFixing log --hash-only - [19]
6F6AAHK4Simplifying pijul::commands::log, and fixing Broken Pipe errors - [20]
RAS4PCNU"Touch" the channel after `pijul diff` if the diff and the prefixes are both empty - [21]
A3RM526YIntegrating identity malleability - [22]
Q4SVMHAERemoving --channel from the changes command - [23]
2K7JLB4ZNo pager on Windows - [24]
VIHXB7SGcommands: set up pager for diff, change, and credit - [*]
QL6K2ZM3Tags
Change contents
- replacement in pijul/src/commands/tag.rs at line 250
super::pager();super::pager(repo.config.pager.as_ref()); - edit in pijul/src/commands/mod.rs at line 123
/// Respect the `pager` key/value pair in both the user's repository config, and their global config./// The global configuration requires no additional arguments, but the other two are optional to cover/// cases in which that information is not available. Users can also disable the pager by not setting/// the `PAGER` environment variable. - replacement in pijul/src/commands/mod.rs at line 128
fn pager() -> bool {if let Ok(less) = std::process::Command::new("less").args(&["--version"]).output()fn pager(repo_config_pager: Option<&crate::config::Choice>) -> bool {if let Some(crate::config::Choice::Never) = repo_config_pager {return false;} else if let Some(crate::config::Choice::Never) = crate::config::Global::load().ok().and_then(|(global, _)| global.pager) - replacement in pijul/src/commands/mod.rs at line 135[5.125]→[5.125:424](∅→∅),[5.424]→[5.22:113](∅→∅),[5.113]→[5.485:506](∅→∅),[5.485]→[5.485:506](∅→∅),[5.506]→[5.114:159](∅→∅)
let regex = regex::bytes::Regex::new("less ([0-9]+)").unwrap();if let Some(caps) = regex.captures(&less.stdout) {if std::str::from_utf8(&caps[1]).unwrap().parse::<usize>().unwrap()>= 530{pager::Pager::with_pager("less -RF").setup();return true;} else {pager::Pager::new().setup();return false;} else if let Ok(pager_env_var) = std::env::var("PAGER") {if !pager_env_var.is_empty() {match pager_env_var.as_str() {"less" => {if let Ok(pager_output) = std::process::Command::new(pager_env_var).args(&["--version"]).output(){let regex = regex::bytes::Regex::new("less ([0-9]+)").unwrap();if let Some(caps) = regex.captures(&pager_output.stdout) {if std::str::from_utf8(&caps[1]).unwrap().parse::<usize>().unwrap()>= 530{pager::Pager::with_pager("less -RF").setup();return true;} else {pager::Pager::new().setup();}}}}owise => {pager::Pager::with_pager(owise).setup();} - edit in pijul/src/commands/log.rs at line 58
let repo_path = repo.path.clone(); - edit in pijul/src/commands/log.rs at line 78
let changes = repo.changes; - edit in pijul/src/commands/log.rs at line 92
repo, - edit in pijul/src/commands/log.rs at line 94
changes,repo_path, - edit in pijul/src/commands/log.rs at line 269
/// The parsed CLI commandcmd: Log, - replacement in pijul/src/commands/log.rs at line 272
changes: libpijul::changestore::filesystem::FileSystem,cmd: Log,repo_path: PathBuf,repo: Repository, - replacement in pijul/src/commands/log.rs at line 326
let inodes = get_inodes(&self.txn, &self.repo_path, &self.cmd.filters)?;let inodes = get_inodes(&self.txn, &self.repo.path, &self.cmd.filters)?; - replacement in pijul/src/commands/log.rs at line 380
let header = self.changes.get_header(&h.into())?;let header = self.repo.changes.get_header(&h.into())?; - edit in pijul/src/commands/log.rs at line 451
let log_iter = LogIterator::try_from(self)?; - replacement in pijul/src/commands/log.rs at line 453
match self.output_format.as_ref().map(|s| s.as_str()) {super::pager(log_iter.repo.config.pager.as_ref());match log_iter.cmd.output_format.as_ref().map(|s| s.as_str()) { - replacement in pijul/src/commands/log.rs at line 458
serde_json::to_writer_pretty(&mut stdout, &LogIterator::try_from(self)?)?serde_json::to_writer_pretty(&mut stdout, &log_iter)? - replacement in pijul/src/commands/log.rs at line 460[5.14535]→[5.14535:14586](∅→∅),[5.14586]→[5.3950:4288](∅→∅),[5.4288]→[5.136485:136499](∅→∅),[5.14683]→[5.136485:136499](∅→∅),[5.136485]→[5.136485:136499](∅→∅)
_ => {super::pager();LogIterator::try_from(self)?.for_each(|entry| {match write!(&mut stdout, "{}", entry) {Ok(_) => Ok(()),Err(e) if e.kind() == std::io::ErrorKind::BrokenPipe => Ok(()),Err(e) => Err(e),}})?}_ => log_iter.for_each(|entry| match write!(&mut stdout, "{}", entry) {Ok(_) => Ok(()),Err(e) if e.kind() == std::io::ErrorKind::BrokenPipe => Ok(()),Err(e) => Err(e),})?, - replacement in pijul/src/commands/diff.rs at line 135
let colors = is_colored();let colors = is_colored(repo.config.pager.as_ref()); - replacement in pijul/src/commands/diff.rs at line 339
pub fn is_colored() -> bool {pub fn is_colored(repo_config_pager: Option<&crate::config::Choice>) -> bool { - replacement in pijul/src/commands/diff.rs at line 350
super::pager();super::pager(repo_config_pager); - replacement in pijul/src/commands/diff.rs at line 354
colors &= super::pager();colors &= super::pager(repo_config_pager); - replacement in pijul/src/commands/credit.rs at line 52
super::pager();super::pager(repo.config.pager.as_ref()); - replacement in pijul/src/commands/change.rs at line 42
let colors = super::diff::is_colored();let colors = super::diff::is_colored(repo.config.pager.as_ref());