feature: add coloured console output
This commit is contained in:
		
							parent
							
								
									9f9b29898d
								
							
						
					
					
						commit
						d3e2abe11b
					
				
					 3 changed files with 7 additions and 5 deletions
				
			
		
							
								
								
									
										2
									
								
								setup.py
									
										
									
									
									
								
							
							
						
						
									
										2
									
								
								setup.py
									
										
									
									
									
								
							|  | @ -5,7 +5,7 @@ setup( | |||
|     version="0.1", | ||||
|     packages=find_packages(where="src"), | ||||
|     package_dir={"": "src"}, | ||||
|     install_requires=["python-frontmatter, "hurry.filesize"], | ||||
|     install_requires=["python-frontmatter", "termcolor"], | ||||
|     entry_points={ | ||||
|         "console_scripts": [ | ||||
|             "run=app:main", | ||||
|  |  | |||
|  | @ -1,6 +1,8 @@ | |||
| import sqlite3 | ||||
| from typing import Optional | ||||
| 
 | ||||
| from termcolor import colored | ||||
| 
 | ||||
| 
 | ||||
| class DatabaseService: | ||||
|     def __init__(self, db_name): | ||||
|  | @ -14,11 +16,11 @@ class DatabaseService: | |||
| 
 | ||||
|         try: | ||||
|             self.connection = sqlite3.connect(f"{self.db_path}/{self.db_name}.db") | ||||
|             print("INFO Database connection established") | ||||
|             print(colored("INFO Database connection established", "light_blue")) | ||||
|             return self.connection | ||||
| 
 | ||||
|         except Exception as e: | ||||
|             raise Exception(f"Problem connecting to database: {e}") | ||||
|             raise Exception(f"ERROR Problem connecting to database: {e}") | ||||
| 
 | ||||
|     def disconnect(self) -> None: | ||||
|         try: | ||||
|  |  | |||
|  | @ -2,7 +2,7 @@ import os | |||
| from datetime import datetime | ||||
| from pathlib import Path | ||||
| 
 | ||||
| from hurry.filesize import size | ||||
| from termcolor import colored | ||||
| 
 | ||||
| from models.entry import Entry | ||||
| from services.parse_markdown_service import ParseMarkdownService | ||||
|  | @ -30,7 +30,7 @@ class ParseFileService: | |||
|         } | ||||
| 
 | ||||
|     def parse_source_directory(self): | ||||
|         print("INFO Indexing entries in source directory") | ||||
|         print(colored("INFO Indexing entries in source directory", "light_blue")) | ||||
|         parsed_entries = [] | ||||
|         with os.scandir(self.source_directory) as dir: | ||||
|             for file in dir: | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 thomasabishop
						thomasabishop