mirror of
https://github.com/starship/starship.git
synced 2024-12-04 06:13:15 +01:00
794ae7b2ad
### Changed - Added current_dir param to segments to make them more testable - Moved all existing integration tests to a `tests/` dir ### Added - A whole bunch of new integration tests
19 lines
538 B
Rust
19 lines
538 B
Rust
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()
|
|
}
|