flowey_cli/
lib.rs

1// Copyright (c) Microsoft Corporation.
2// Licensed under the MIT License.
3
4#![expect(missing_docs)]
5#![forbid(unsafe_code)]
6
7use flowey_core::pipeline::IntoPipeline;
8use std::path::Path;
9
10mod cli;
11mod flow_resolver;
12mod pipeline_resolver;
13mod var_db;
14
15/// Entrypoint into generic flowey infrastructure.
16pub fn flowey_main<ProjectPipelines: clap::Subcommand + IntoPipeline>(
17    flowey_crate: &str,
18    repo_root: &Path,
19) -> ! {
20    if let Err(e) = cli::cli_main::<ProjectPipelines>(flowey_crate, repo_root) {
21        log::error!("Error: {:#}", e);
22        std::process::exit(-1);
23    } else {
24        std::process::exit(0)
25    }
26}
27
28fn running_in_wsl() -> bool {
29    let Ok(output) = std::process::Command::new("wslpath")
30        .args(["-aw", "/"])
31        .output()
32    else {
33        return false;
34    };
35    String::from_utf8_lossy(&output.stdout).starts_with(r"\\wsl.localhost")
36}