1
0
mirror of https://github.com/Llewellynvdm/starship.git synced 2024-10-04 08:03:04 +00:00
starship/tests/common.rs

19 lines
538 B
Rust
Raw Normal View History

use clap::{App, Arg};
use starship::modules;
use std::path::Path;
pub fn render_segment(module: &str, path: &Path) -> String {
render_segment_with_status(module, path, "0")
}
pub fn render_segment_with_status(module: &str, path: &Path, status: &str) -> String {
// Create an `Arg` with status_code of "0"
let args = App::new("starship")
.arg(Arg::with_name("status_code"))
.get_matches_from(vec!["starship", status]);
let segment = modules::handle(module, path, &args);
segment.unwrap().output()
}