limb 0.1.0

A focused CLI for git worktree management
Documentation
//! Implements `limb config`. Prints resolved configuration as JSON.

use anyhow::Result;
use serde::Serialize;

use crate::config::{Global, Repo};
use crate::context::Context;

/// Debug-friendly combined view of the resolved configuration.
#[derive(Serialize)]
struct Resolved {
    global: Global,
    repo: Option<Repo>,
}

/// Runs `limb config`.
///
/// Emits a single JSON document with both the resolved global config and
/// the nearest `.limb.toml` (if any). Intended for piping into `jq`.
///
/// # Errors
///
/// Returns an error if the global config cannot be loaded.
pub fn run(ctx: &Context) -> Result<()> {
    let resolved = Resolved {
        global: ctx.global()?,
        repo: ctx.repo_config_optional(),
    };
    println!("{}", serde_json::to_string_pretty(&resolved)?);
    Ok(())
}