jarvy 0.0.5

Jarvy is a fast, cross-platform CLI that installs and manages developer tools across macOS and Linux.
Documentation
//! Handler for `jarvy shell-init`
//!
//! Outputs a shell snippet to stdout for eval in RC files.

use crate::env::{detect_shell, parse_shell};
use crate::shell_init::generate_rc_snippet;

pub fn run_shell_init(shell: Option<&str>) -> i32 {
    let shell_type = match shell {
        Some(s) => match parse_shell(s) {
            Ok(st) => st,
            Err(e) => {
                eprintln!("Error: {}", e);
                return 1;
            }
        },
        None => detect_shell(),
    };

    print!("{}", generate_rc_snippet(shell_type));
    0
}