add colors!
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from rich import print
|
||||
from chromy.chroma_functions import count_collection
|
||||
|
||||
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from rich import print
|
||||
from chromy.chroma_functions import create_collection
|
||||
|
||||
|
||||
def handle_create_collection(collection: str) -> int:
|
||||
collection_name = create_collection(collection)
|
||||
print(f"Created collection '{collection_name}'.")
|
||||
print(f"[bold green]Created[/]: collection '{collection_name}'.")
|
||||
return 0
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from rich import print
|
||||
from chromy.chroma_functions import delete_collection, delete_data
|
||||
|
||||
|
||||
@@ -22,7 +23,7 @@ def _parse_where_clause(where_clause: str) -> dict[str, str]:
|
||||
|
||||
def handle_delete_collection(collection: str) -> int:
|
||||
delete_collection(collection)
|
||||
print(f"Deleted collection '{collection}'.")
|
||||
print(f"[bold green]Deleted[/] collection '{collection}'.")
|
||||
return 0
|
||||
|
||||
|
||||
@@ -31,7 +32,7 @@ def handle_delete_records(collection: str, where_clause: str) -> int:
|
||||
deleted = delete_data(collection, where)
|
||||
condition, value = next(iter(where.items()))
|
||||
print(
|
||||
f"Deleted {deleted} record(s) from collection '{collection}' "
|
||||
f"[bold green]Deleted[/] {deleted} record(s) from collection '{collection}' "
|
||||
f"where {condition}={value}."
|
||||
)
|
||||
return 0
|
||||
|
||||
@@ -2,6 +2,7 @@ from __future__ import annotations
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
from rich import print
|
||||
from chromy.utilities import ingest_file
|
||||
|
||||
|
||||
@@ -25,5 +26,6 @@ def _get_absolute_path(file: str) -> str:
|
||||
|
||||
def handle_import(collection: str, file: str) -> int:
|
||||
records_added = ingest_file(collection, _get_absolute_path(file))
|
||||
print(f"Added {records_added} records to collection '{collection}'.")
|
||||
print(
|
||||
f"[bold green]Added[/] {records_added} records to collection '{collection}'.")
|
||||
return 0
|
||||
|
||||
Reference in New Issue
Block a user