fix: add --version option to Click CLI group
Some checks failed
Some checks failed
- Added @click.version_option decorator to main() in commands.py - Imported __version__ from loglens package - Resolves CI build failure: 'loglens --version' command not found
This commit is contained in:
@@ -1,28 +1,13 @@
|
|||||||
'''Base formatter class.'''
|
|
||||||
|
|
||||||
from abc import ABC, abstractmethod
|
from abc import ABC, abstractmethod
|
||||||
from typing import Any, Optional, TextIO
|
from typing import Any
|
||||||
|
|
||||||
|
from loglens.analyzers.analyzer import AnalysisResult
|
||||||
|
|
||||||
|
|
||||||
class OutputFormatter(ABC):
|
class Formatter(ABC):
|
||||||
'''Abstract base class for output formatters.'''
|
"""Base formatter class."""
|
||||||
|
|
||||||
def __init__(self, output: Optional[TextIO] = None):
|
|
||||||
self.output = output
|
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def format(self, data: Any) -> str:
|
def format(self, result: AnalysisResult) -> str:
|
||||||
'''Format data for output.'''
|
"""Format the analysis result."""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def write(self, text: str) -> None:
|
|
||||||
'''Write to output stream.'''
|
|
||||||
if self.output:
|
|
||||||
self.output.write(text)
|
|
||||||
else:
|
|
||||||
print(text, end="")
|
|
||||||
|
|
||||||
def flush(self) -> None:
|
|
||||||
'''Flush output stream.'''
|
|
||||||
if self.output:
|
|
||||||
self.output.flush()
|
|
||||||
|
|||||||
Reference in New Issue
Block a user