File: command.rs

package info (click to toggle)
rust-bat 0.25.0-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,096 kB
  • sloc: sh: 255; python: 39; makefile: 14
file content (41 lines) | stat: -rw-r--r-- 1,177 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#![allow(unused)] // Because indirectly included by e.g.integration_tests.rs, but not everything inside is used

use assert_cmd::cargo::CommandCargoExt;
use std::process::Command;

pub fn bat_raw_command_with_config() -> Command {
    let mut cmd = Command::cargo_bin("bat").unwrap();
    cmd.current_dir("tests/examples");
    cmd.env_remove("BAT_CACHE_PATH");
    cmd.env_remove("BAT_CONFIG_DIR");
    cmd.env_remove("BAT_CONFIG_PATH");
    cmd.env_remove("BAT_OPTS");
    cmd.env_remove("BAT_PAGER");
    cmd.env_remove("BAT_STYLE");
    cmd.env_remove("BAT_TABS");
    cmd.env_remove("BAT_THEME");
    cmd.env_remove("COLORTERM");
    cmd.env_remove("NO_COLOR");
    cmd.env_remove("PAGER");
    cmd.env_remove("LESSOPEN");
    cmd.env_remove("LESSCLOSE");
    cmd.env_remove("SHELL");
    cmd
}

#[cfg(test)]
pub fn bat_raw_command() -> Command {
    let mut cmd = bat_raw_command_with_config();
    cmd.arg("--no-config");
    cmd
}

#[cfg(test)]
pub fn bat_with_config() -> assert_cmd::Command {
    assert_cmd::Command::from_std(bat_raw_command_with_config())
}

#[cfg(test)]
pub fn bat() -> assert_cmd::Command {
    assert_cmd::Command::from_std(bat_raw_command())
}