Skip to content

Commit e8b79b0

Browse files
committed
another attempt to fix cosmetic issue
1 parent 2afd0b6 commit e8b79b0

File tree

4 files changed

+49
-26
lines changed

4 files changed

+49
-26
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Choose an installation method:
3333
sudo apt update && sudo apt install pipx
3434

3535
# Install code-indexer using pipx (from latest release)
36-
pipx install https://github.com/jsbattig/code-indexer/releases/download/v0.0.24.0/code_indexer-0.0.24.0-py3-none-any.whl
36+
pipx install https://github.com/jsbattig/code-indexer/releases/download/v0.0.25.0/code_indexer-0.0.25.0-py3-none-any.whl
3737

3838
# Or install directly from git (latest development)
3939
pipx install git+https://github.com/jsbattig/code-indexer.git
@@ -49,7 +49,7 @@ python3 -m venv ~/code-indexer-env
4949
source ~/code-indexer-env/bin/activate
5050

5151
# Install from GitHub releases
52-
pip install https://github.com/jsbattig/code-indexer/releases/download/v0.0.24.0/code_indexer-0.0.24.0-py3-none-any.whl
52+
pip install https://github.com/jsbattig/code-indexer/releases/download/v0.0.25.0/code_indexer-0.0.25.0-py3-none-any.whl
5353

5454
# Or install directly from git (latest development)
5555
pip install git+https://github.com/jsbattig/code-indexer.git

src/code_indexer/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@
55
to provide code search capabilities.
66
"""
77

8-
__version__ = "0.0.24.0"
8+
__version__ = "0.0.25.0"
99
__author__ = "Code Indexer Team"

src/code_indexer/cli.py

Lines changed: 42 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
TimeRemainingColumn,
1919
)
2020
from rich.syntax import Syntax
21+
from rich.table import Column
2122

2223
from .config import ConfigManager, Config
2324
from .services import QdrantClient, DockerManager, EmbeddingProviderFactory
@@ -29,40 +30,50 @@
2930

3031
class GracefulInterruptHandler:
3132
"""Handler for graceful interruption of long-running operations."""
32-
33+
3334
def __init__(self, console: Console, operation_name: str = "Operation"):
3435
self.console = console
3536
self.operation_name = operation_name
3637
self.interrupted = False
3738
self.original_sigint_handler = None
3839
self.progress_bar = None
39-
40+
4041
def __enter__(self):
41-
self.original_sigint_handler = signal.signal(signal.SIGINT, self._signal_handler)
42+
self.original_sigint_handler = signal.signal(
43+
signal.SIGINT, self._signal_handler
44+
)
4245
return self
43-
46+
4447
def __exit__(self, exc_type, exc_val, exc_tb):
4548
# Restore original signal handler
4649
signal.signal(signal.SIGINT, self.original_sigint_handler)
47-
50+
4851
# If we were interrupted, show final message
4952
if self.interrupted:
5053
if self.progress_bar:
5154
self.progress_bar.stop()
5255
self.console.print() # New line
53-
self.console.print(f"🛑 {self.operation_name} interrupted by user", style="yellow")
54-
self.console.print("📊 Progress has been saved and can be resumed later", style="cyan")
56+
self.console.print(
57+
f"🛑 {self.operation_name} interrupted by user", style="yellow"
58+
)
59+
self.console.print(
60+
"📊 Progress has been saved and can be resumed later", style="cyan"
61+
)
5562
return True # Suppress the KeyboardInterrupt exception
56-
63+
5764
def _signal_handler(self, signum, frame):
5865
"""Handle SIGINT (Ctrl-C) gracefully."""
5966
self.interrupted = True
6067
if self.progress_bar:
6168
self.progress_bar.stop()
6269
self.console.print() # New line
63-
self.console.print(f"🛑 Interrupting {self.operation_name.lower()}...", style="yellow")
64-
self.console.print("⏳ Finishing current file and saving progress...", style="cyan")
65-
70+
self.console.print(
71+
f"🛑 Interrupting {self.operation_name.lower()}...", style="yellow"
72+
)
73+
self.console.print(
74+
"⏳ Finishing current file and saving progress...", style="cyan"
75+
)
76+
6677
def set_progress_bar(self, progress_bar):
6778
"""Set the progress bar to stop when interrupted."""
6879
self.progress_bar = progress_bar
@@ -700,12 +711,15 @@ def progress_callback(current, total, file_path, error=None, info=None):
700711
"•",
701712
TimeRemainingColumn(),
702713
"•",
703-
TextColumn("[cyan]{task.description}", no_wrap=False),
714+
TextColumn(
715+
"[cyan]{task.description}",
716+
table_column=Column(no_wrap=False, overflow="fold"),
717+
),
704718
console=console,
705719
)
706720
progress_bar.start()
707721
task_id = progress_bar.add_task("Starting...", total=total)
708-
722+
709723
# Register progress bar with interrupt handler
710724
if interrupt_handler:
711725
interrupt_handler.set_progress_bar(progress_bar)
@@ -741,9 +755,7 @@ def progress_callback(current, total, file_path, error=None, info=None):
741755

742756
# Check for conflicting flags
743757
if clear and reconcile:
744-
console.print(
745-
"❌ Cannot use --clear and --reconcile together", style="red"
746-
)
758+
console.print("❌ Cannot use --clear and --reconcile together", style="red")
747759
sys.exit(1)
748760

749761
# Use graceful interrupt handling for the indexing operation
@@ -752,11 +764,11 @@ def progress_callback(current, total, file_path, error=None, info=None):
752764
operation_name = "Reconciliation"
753765
elif clear:
754766
operation_name = "Full reindexing"
755-
767+
756768
try:
757769
with GracefulInterruptHandler(console, operation_name) as handler:
758770
interrupt_handler = handler
759-
771+
760772
stats = smart_indexer.smart_index(
761773
force_full=clear,
762774
reconcile_with_database=reconcile,
@@ -866,7 +878,10 @@ def progress_callback(
866878
"•",
867879
TimeRemainingColumn(),
868880
"•",
869-
TextColumn("[cyan]{task.description}", no_wrap=False),
881+
TextColumn(
882+
"[cyan]{task.description}",
883+
table_column=Column(no_wrap=False, overflow="fold"),
884+
),
870885
console=console,
871886
)
872887
progress_bar.start()
@@ -1011,7 +1026,10 @@ def process_changes():
10111026
"•",
10121027
TimeElapsedColumn(),
10131028
"•",
1014-
TextColumn("[cyan]{task.description}", no_wrap=False),
1029+
TextColumn(
1030+
"[cyan]{task.description}",
1031+
table_column=Column(no_wrap=False, overflow="fold"),
1032+
),
10151033
console=console,
10161034
)
10171035
batch_progress.start()
@@ -1145,7 +1163,10 @@ def process_changes():
11451163

11461164
try:
11471165
with GracefulInterruptHandler(console, "File watching") as handler:
1148-
console.print("👀 Watching for file changes... (Press Ctrl-C to stop)", style="dim")
1166+
console.print(
1167+
"👀 Watching for file changes... (Press Ctrl-C to stop)",
1168+
style="dim",
1169+
)
11491170
while not handler.interrupted:
11501171
time.sleep(1)
11511172
except KeyboardInterrupt:

src/code_indexer/services/smart_indexer.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@ def calculate_throughput() -> ThroughputStats:
610610

611611
info = " | ".join(info_parts) if info_parts else None
612612
result = progress_callback(i + 1, len(files), file_path, info=info)
613-
613+
614614
# Check if we've been interrupted
615615
if result == "INTERRUPT":
616616
break
@@ -622,7 +622,9 @@ def calculate_throughput() -> ThroughputStats:
622622
update_metadata(file_path, chunks_count=0, failed=True)
623623

624624
if progress_callback:
625-
result = progress_callback(i + 1, len(files), file_path, error=str(e))
625+
result = progress_callback(
626+
i + 1, len(files), file_path, error=str(e)
627+
)
626628
# Check if we've been interrupted even on error
627629
if result == "INTERRUPT":
628630
break

0 commit comments

Comments
 (0)