mirror of
https://github.com/marcoallegretti/karapace.git
synced 2026-03-27 05:53:10 +00:00
Add 'karapace new' to generate a manifest from templates or prompts. Add 'karapace tui' to launch the terminal UI. Improve env-id resolution errors in non-JSON output with suggestions. Add dialoguer and toml as CLI dependencies.
14 lines
561 B
Rust
14 lines
561 B
Rust
use super::{resolve_env_id_pretty, EXIT_SUCCESS};
|
|
use karapace_core::{Engine, StoreLock};
|
|
use karapace_store::StoreLayout;
|
|
use std::path::Path;
|
|
|
|
pub fn run(engine: &Engine, store_path: &Path, env_id: &str) -> Result<u8, String> {
|
|
let layout = StoreLayout::new(store_path);
|
|
let _lock = StoreLock::acquire(&layout.lock_file()).map_err(|e| format!("store lock: {e}"))?;
|
|
|
|
let resolved = resolve_env_id_pretty(engine, env_id)?;
|
|
engine.freeze(&resolved).map_err(|e| e.to_string())?;
|
|
println!("frozen environment {env_id}");
|
|
Ok(EXIT_SUCCESS)
|
|
}
|