//! Implements `limb init`. Emits shell integration for `eval`.

use anyhow::Result;

use crate::cli::InitArgs;
use crate::shell;

/// Runs `limb init`.
///
/// Writes [`shell::integration`] output to stdout. Users add
/// `eval "$(limb init zsh)"` (or their shell of choice) to their rc file.
///
/// # Errors
///
/// The return type is `Result` for dispatch-symmetry; no error paths are
/// currently exercised.
#[allow(clippy::unnecessary_wraps)]
pub fn run(args: &InitArgs) -> Result<()> {
    let out = shell::integration(args.shell, &args.prefix);
    print!("{out}");
    Ok(())
}
