-
Notifications
You must be signed in to change notification settings - Fork 121
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
137 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
""" | ||
Elia CLI | ||
""" | ||
|
||
import click | ||
|
||
from elia_chat.app import app | ||
from elia_chat.database.create_database import create_database | ||
from elia_chat.database.models import sqlite_file_name | ||
|
||
|
||
@click.group(invoke_without_command=True) | ||
@click.pass_context | ||
def cli(context: click.Context) -> None: | ||
""" | ||
Elia: A terminal ChatGPT client built with Textual | ||
""" | ||
# Run the app if no subcommand is provided | ||
if context.invoked_subcommand is None: | ||
# Create the database if it doesn't exist | ||
if sqlite_file_name.exists() is False: | ||
create_database() | ||
app.run() | ||
|
||
|
||
@cli.group() | ||
def db() -> None: | ||
""" | ||
Elia database interactions | ||
""" | ||
|
||
|
||
@db.command() | ||
def reset() -> None: | ||
""" | ||
Reset the database | ||
""" | ||
sqlite_file_name.unlink(missing_ok=True) | ||
create_database() | ||
click.echo(f"♻️ Database reset @ {sqlite_file_name}") | ||
|
||
|
||
if __name__ == "__main__": | ||
cli() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,10 +20,5 @@ def on_mount(self) -> None: | |
|
||
app = Elia() | ||
|
||
|
||
def run(): | ||
app.run() | ||
|
||
|
||
if __name__ == "__main__": | ||
app.run() |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters