rustyroad 1.3.0

Rusty Road is a framework written in Rust that is based on Ruby on Rails. It is designed to provide the familiar conventions and ease of use of Ruby on Rails, while also taking advantage of the performance and efficiency of Rust.
Documentation
//! Printing the current lifecycle state.

use super::super::status::Status;
use crate::database::versions::naming;

/// Prints the current lifecycle state.
pub(in crate::database::migrations::cli::version) fn status(status: &Status) {
    line("Current version", status.current.as_deref(), status);
    line("In progress    ", status.active.as_deref(), status);

    if status.active.is_some() {
        println!("\nRun 'rustyroad migration complete' or 'rustyroad migration rollback-version'.");
    }
    if let Some(baseline) = &status.baseline {
        println!("Last baseline:   {baseline}");
    }
}

/// Prints one labelled version line, with its schema when versioned.
fn line(label: &str, version: Option<&str>, status: &Status) {
    match version {
        Some(version) => {
            println!("{label}: {version}");
            if status.versioned {
                println!(
                    "  schema: {}",
                    naming::versioned_schema(&status.schema, version)
                );
            }
        }
        None => println!("{label}: none"),
    }
}