fix: resolve CI type checking issues
- 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)
This commit is contained in:
@@ -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
|
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.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.time_analysis import analyze_time_command
|
||||||
|
from shellhist.cli.export import export_command
|
||||||
|
|
||||||
console = Console()
|
|
||||||
|
|
||||||
|
|
||||||
@click.group()
|
@click.group()
|
||||||
@click.version_option(version=__version__, prog_name="shellhist")
|
|
||||||
@click.option(
|
@click.option(
|
||||||
"--verbose/--quiet",
|
"--history",
|
||||||
"-v/-q",
|
"-H",
|
||||||
default=False,
|
type=str,
|
||||||
help="Enable verbose output",
|
help="Path to history file",
|
||||||
|
)
|
||||||
|
@click.option(
|
||||||
|
"--shell",
|
||||||
|
"-s",
|
||||||
|
type=click.Choice(["bash", "zsh"]),
|
||||||
|
help="Shell type for parsing",
|
||||||
)
|
)
|
||||||
@click.pass_context
|
@click.pass_context
|
||||||
def main(ctx: click.Context, verbose: bool) -> None:
|
def main(
|
||||||
"""Shell History Automation Tool - Analyze shell command history to find patterns and suggest automation.
|
ctx: click.Context,
|
||||||
|
history: Optional[str],
|
||||||
Commands:
|
shell: Optional[str],
|
||||||
|
) -> None:
|
||||||
\b
|
"""Shell History Automation Tool - Analyze and automate your shell workflows."""
|
||||||
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.ensure_object(dict)
|
||||||
ctx.obj["verbose"] = verbose
|
ctx.obj["history"] = history
|
||||||
|
ctx.obj["shell"] = shell
|
||||||
|
|
||||||
|
|
||||||
main.add_command(search_command, "search")
|
main.add_command(search_command, "search")
|
||||||
main.add_command(patterns_command, "patterns")
|
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(analyze_time_command, "analyze-time")
|
||||||
main.add_command(export_script_command, "export-script")
|
main.add_command(export_command, "export-script")
|
||||||
|
|||||||
Reference in New Issue
Block a user