47 lines
1.5 KiB
Python
47 lines
1.5 KiB
Python
"""Main CLI module for shell history automation tool."""
|
|
|
|
import click
|
|
from rich.console import Console
|
|
|
|
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.time_analysis import analyze_time_command
|
|
|
|
|
|
console = Console()
|
|
|
|
|
|
@click.group()
|
|
@click.version_option(version=__version__, prog_name="shellhist")
|
|
@click.option(
|
|
"--verbose/--quiet",
|
|
"-v/-q",
|
|
default=False,
|
|
help="Enable verbose output",
|
|
)
|
|
@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
|
|
"""
|
|
ctx.ensure_object(dict)
|
|
ctx.obj["verbose"] = verbose
|
|
|
|
|
|
main.add_command(search_command, "search")
|
|
main.add_command(patterns_command, "patterns")
|
|
main.add_command(suggest_aliases_command, "suggest-aliases")
|
|
main.add_command(analyze_time_command, "analyze-time")
|
|
main.add_command(export_script_command, "export-script")
|