tree-tui 0.1.3

An interactive terminal UI for visualizing directories: code, size, and git stats.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//! Opening the selected file in the user's pager (to preview it).

use std::path::Path;

use crate::launch;

/// Open `path` in the user's pager, blocking until it exits.
///
/// The command is `$PAGER`, falling back to `less`. The value is split on
/// whitespace so simple flags work (e.g. `less -R`, `bat --paging=always`).
/// The caller has already suspended the TUI.
pub fn open(path: &Path) {
    let spec = std::env::var("PAGER").unwrap_or_else(|_| "less".to_string());
    launch::run("pager", &spec, path);
}