diff --git a/shellhist/cli/__init__.py b/shellhist/cli/__init__.py index 068f5fb..435c8f3 100644 --- a/shellhist/cli/__init__.py +++ b/shellhist/cli/__init__.py @@ -1,46 +1,45 @@ -"""Main CLI module for shell history automation tool.""" +"""CLI interface for shell history automation tool.""" + +import sys +from typing import Optional import click -from rich.console import Console +from shellhist.core import HistoryLoader -from shellhist import __version__ -from shellhist.cli.alias import suggest_aliases_command -from shellhist.cli.export import export_script_command -from shellhist.cli.patterns import patterns_command 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 - - -console = Console() +from shellhist.cli.export import export_command @click.group() -@click.version_option(version=__version__, prog_name="shellhist") @click.option( - "--verbose/--quiet", - "-v/-q", - default=False, - help="Enable verbose output", + "--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, verbose: bool) -> None: - """Shell History Automation Tool - Analyze shell command history to find patterns and suggest automation. - - Commands: - - \b - search Search history with fuzzy matching - patterns Detect repetitive command patterns - suggest-aliases Generate alias suggestions for patterns - analyze-time Analyze time-based command patterns - export-script Export patterns to executable scripts - """ +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["verbose"] = verbose + ctx.obj["history"] = history + ctx.obj["shell"] = shell main.add_command(search_command, "search") main.add_command(patterns_command, "patterns") -main.add_command(suggest_aliases_command, "suggest-aliases") +main.add_command(alias_command, "suggest-aliases") main.add_command(analyze_time_command, "analyze-time") -main.add_command(export_script_command, "export-script") +main.add_command(export_command, "export-script")