git-gamble 2.14.1

blend TDD + TCR to make sure to develop the right thing 😌, baby step by baby step πŸ‘ΆπŸ¦Ά
Documentation
use std::process::exit;

use clap::Parser;

use git_gamble::git_gamble::cli::Cli;
#[cfg(any(
	feature = "with_subcommand_generate_shell_completions",
	feature = "with_subcommand_hook"
))]
use git_gamble::git_gamble::cli::OptionalSubcommands;
use git_gamble::git_gamble::gamble::gamble;

fn main() {
	#[cfg(feature = "with_log")]
	pretty_env_logger::init();

	human_panic::setup_panic!(
		human_panic::metadata!()
			.support("- Issue: https://gitlab.com/pinage404/git-gamble/-/issues/new")
	);

	let options = Cli::parse();
	log::info!("{options:#?}");

	let result = match options.optional_subcommands {
		#[cfg(feature = "with_subcommand_generate_shell_completions")]
		Some(OptionalSubcommands::GenerateShellCompletions(generate_shell_completions_opt)) => {
			use git_gamble::git_gamble::subcommand_generate_shell_completions::generate_shell_completions::subcommand_generate_shell_completions;

			subcommand_generate_shell_completions(
				env!("CARGO_BIN_NAME"),
				generate_shell_completions_opt,
			);
			Ok(())
		}
		#[cfg(feature = "with_subcommand_hook")]
		Some(OptionalSubcommands::Hook(ref hook_options)) => {
			use git_gamble::git_gamble::subcommand_hook::handle_hook::handle_hook;

			handle_hook(options.repository_path.as_path(), hook_options)
		}
		None => gamble(options),
	};

	match result {
		Ok(()) => exit(0),
		Err(error) => {
			error.display_messages();
			exit(error.code)
		}
	}
}