- Add return type annotations to __hash__ (-> int) and __eq__ (-> bool) in HistoryEntry - Add TextIO import and type annotations for file parameters - Add type ignore comment for fuzzywuzzy import - Add HistoryEntry import and list type annotations in time_analysis - Add assert statements for Optional[datetime] timestamps - Add TypedDict classes for type-safe pattern dictionaries - Add CommandPattern import and list[CommandPattern] type annotation - Add -> None return types to all test methods - Remove unused HistoryEntry import (F401)
46 lines
1.1 KiB
Python
46 lines
1.1 KiB
Python
"""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")
|