pub mod bump;
pub mod doctor;
pub mod init;
pub mod info;
pub mod notes;
pub mod preflight;
pub mod ship;
use anyhow::Context;
use inquire::Select;
use owo_colors::OwoColorize;
use scrat_core::ecosystem::Ecosystem;
pub fn prompt_ecosystem_selection() -> anyhow::Result<Ecosystem> {
println!(
"\n{}",
"Could not auto-detect project type.".yellow().bold()
);
println!("{}", "No recognized marker file found.".dimmed());
println!();
let options = vec![
"Generic (no ecosystem-specific behavior)".to_string(),
"Rust".to_string(),
"Node".to_string(),
"Go".to_string(),
"PHP".to_string(),
"Python".to_string(),
"Ruby".to_string(),
"Swift".to_string(),
"Exit".to_string(),
];
let selection = Select::new("Select project ecosystem:", options)
.with_starting_cursor(0)
.prompt()
.context("ecosystem selection cancelled")?;
match selection.as_str() {
s if s.starts_with("Generic") => Ok(Ecosystem::Generic),
"Rust" => Ok(Ecosystem::Rust),
"Node" => Ok(Ecosystem::Node),
"Go" => Ok(Ecosystem::Go),
"PHP" => Ok(Ecosystem::Php),
"Python" => Ok(Ecosystem::Python),
"Ruby" => Ok(Ecosystem::Ruby),
"Swift" => Ok(Ecosystem::Swift),
"Exit" => {
println!("{}", "Cancelled.".yellow());
std::process::exit(0);
}
_ => anyhow::bail!("unexpected selection: {selection}"),
}
}