gitbox 2.1.3

Git toolbox to simplify adoption of conventional commits and semantic version, among other things.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use hierrorchy::error_leaf;
use which::which;

#[error_leaf("Failed to find 'podman' or 'docker' in path")]
pub struct ContainerManagerNotFoundError {}

pub fn container_manager() -> Result<String, ContainerManagerNotFoundError> {
    Ok(match which("podman") {
        Ok(value) => value,
        Err(_) => match which("docker") {
            Ok(value) => value,
            Err(_) => return Err(ContainerManagerNotFoundError {}),
        },
    }
    .to_str()
    .expect("A binary path is a valid string")
    .to_owned())
}