summaryrefslogtreecommitdiffstats
path: root/src/format.rs
blob: 5c1bf39f085d0286d6dfe4730f0f75955daee6a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use std::borrow::Cow;

use crate::config::Config;
use crate::features;

/// If output is going to a tty, emit hyperlinks if requested.
// Although raw output should basically be emitted unaltered, we do this.
pub fn format_raw_line<'a>(line: &'a str, config: &Config) -> Cow<'a, str> {
    if config.hyperlinks && atty::is(atty::Stream::Stdout) {
        features::hyperlinks::format_commit_line_with_osc8_commit_hyperlink(line, config)
    } else {
        Cow::from(line)
    }
}