Add core source files: main, models, config
This commit is contained in:
35
src/codexchange/main.py
Normal file
35
src/codexchange/main.py
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
"""Main entry point for CodeXchange CLI."""
|
||||||
|
|
||||||
|
import typer
|
||||||
|
|
||||||
|
from codexchange.config import get_config
|
||||||
|
from codexchange.cli.commands import convert_cmd, batch_convert_cmd, list_models_cmd, list_languages_cmd
|
||||||
|
|
||||||
|
app = typer.Typer(
|
||||||
|
name="codexchange",
|
||||||
|
help="CodeXchange CLI - Convert code between programming languages using local LLMs",
|
||||||
|
add_completion=False
|
||||||
|
)
|
||||||
|
|
||||||
|
app.command("convert", help="Convert a single file from one language to another")(convert_cmd)
|
||||||
|
app.command("batch-convert", help="Convert multiple files in a directory")(batch_convert_cmd)
|
||||||
|
app.command("list-models", help="List available Ollama models")(list_models_cmd)
|
||||||
|
app.command("list-languages", help="List supported programming languages")(list_languages_cmd)
|
||||||
|
|
||||||
|
|
||||||
|
@app.callback()
|
||||||
|
def callback(
|
||||||
|
verbose: bool = typer.Option(False, "--verbose", "-v", help="Enable verbose output"),
|
||||||
|
) -> None:
|
||||||
|
"""CodeXchange CLI - Convert code between programming languages using local LLMs."""
|
||||||
|
config = get_config()
|
||||||
|
config.verbose = verbose
|
||||||
|
|
||||||
|
|
||||||
|
def main() -> None:
|
||||||
|
"""Entry point for the CLI application."""
|
||||||
|
app()
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
Reference in New Issue
Block a user