1pub mod commander;
2pub mod lookup;
3pub mod sequel;
4
5use std::fs;
6use std::path::Path;
7
8use anyhow::{
9 Context as _,
10 Result as AnyhowResult,
11};
12
13use indicatif::ProgressStyle;
14
15pub fn ensure_migration_state_dir_exists() -> AnyhowResult<()> {
17 let migration_dir = Path::new(".migrations-state");
18
19 if !migration_dir.exists() {
22 fs::create_dir_all(migration_dir).context("Failed to create migrations directory")?;
23 }
24
25 Ok(())
26}
27
28pub fn progress_style() -> AnyhowResult<ProgressStyle> {
30 let style = ProgressStyle::default_bar()
31 .template("{spinner:.green} [{prefix:.bold.dim}] {wide_msg:.cyan/blue} ")?
32 .tick_chars("⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⦿");
33
34 Ok(style)
35}