"""CLI interface for shell history automation tool.""" import sys from typing import Optional import click from shellhist.core import HistoryLoader from shellhist.cli.search import search_command from shellhist.cli.patterns import patterns_command from shellhist.cli.alias import alias_command from shellhist.cli.time_analysis import analyze_time_command from shellhist.cli.export import export_command @click.group() @click.option( "--history", "-H", type=str, help="Path to history file", ) @click.option( "--shell", "-s", type=click.Choice(["bash", "zsh"]), help="Shell type for parsing", ) @click.pass_context def main( ctx: click.Context, history: Optional[str], shell: Optional[str], ) -> None: """Shell History Automation Tool - Analyze and automate your shell workflows.""" ctx.ensure_object(dict) ctx.obj["history"] = history ctx.obj["shell"] = shell main.add_command(search_command, "search") main.add_command(patterns_command, "patterns") main.add_command(alias_command, "suggest-aliases") main.add_command(analyze_time_command, "analyze-time") main.add_command(export_command, "export-script")