1
0
mirror of https://github.com/Llewellynvdm/starship.git synced 2024-11-24 21:57:41 +00:00

fix(docker_context): ignore the "default" context (#3803) (#3804)

Co-authored-by: Thomas Kintscher <thomas@flowciety.de>
This commit is contained in:
Thomas Kintscher 2022-04-07 07:54:50 +02:00 committed by GitHub
parent 441ebb39b9
commit 230e85be37
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -57,6 +57,10 @@ pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> {
}
};
if ctx == "default" {
return None;
}
let parsed = StringFormatter::new(config.format).and_then(|formatter| {
formatter
.map_meta(|variable, _| match variable {
@ -307,6 +311,24 @@ mod tests {
cfg_dir.close()
}
#[test]
fn test_docker_context_default() -> io::Result<()> {
let cfg_dir = tempfile::tempdir()?;
let actual = ModuleRenderer::new("docker_context")
.env("DOCKER_CONTEXT", "default")
.config(toml::toml! {
[docker_context]
only_with_files = false
})
.collect();
let expected = None;
assert_eq!(expected, actual);
cfg_dir.close()
}
#[test]
fn test_docker_context_overrides_config() -> io::Result<()> {
let cfg_dir = tempfile::tempdir()?;