Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 70 additions & 0 deletions terminalgpt/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import os
import sys
import time
import importlib.metadata as MetaInfo

import click
from colorama import Fore, Style
Expand Down Expand Up @@ -451,10 +452,79 @@ def delete(ctx):
return


@click.command(help="Information about the TerminalGPT")
@click.pass_context
def info(ctx):
"""
Display information about the TerminalGPT application.

This function retrieves and prints various pieces of information about the
TerminalGPT application, including the author, version, model, token limit,
and style. It uses the provided context object to access necessary managers
and printers.

"""

enc_manager: EncryptionManager = ctx.obj["ENC_MNGR"]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need we need to set the encryption manager here. it can be removed.

printer: Printer = ctx.obj["PRINTER"]
enc_manager.get_api_key()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same, we don't need to set the api key


try:
metadata = MetaInfo.metadata("terminalgpt")
meta_style = Fore.WHITE
except MetaInfo.PackageNotFoundError:
metadata = dict(author="Not Available", version="Not Available")
meta_style = Fore.RED + Style.BRIGHT

printer.printt(
Style.BRIGHT
+ Fore.YELLOW
+ "Author: "
+ meta_style
+ metadata.get("author", "")
+ Style.RESET_ALL
)
printer.printt(
Style.BRIGHT
+ Fore.YELLOW
+ "Version: "
+ meta_style
+ metadata.get("version", "")
+ Style.RESET_ALL
)
printer.printt(
Style.BRIGHT
+ Fore.YELLOW
+ "Model: "
+ Fore.WHITE
+ ctx.obj["MODEL"]
+ Style.RESET_ALL
)
printer.printt(
Style.BRIGHT
+ Fore.YELLOW
+ "Token Limit: "
+ Fore.WHITE
+ str(ctx.obj["TOKEN_LIMIT"])
+ Style.RESET_ALL
)
printer.printt(
Style.BRIGHT
+ Fore.YELLOW
+ "Style: "
+ Fore.WHITE
+ str(ctx.obj["STYLE"])
+ Style.RESET_ALL
)

return


cli.add_command(install)
cli.add_command(new)
cli.add_command(load)
cli.add_command(delete)
cli.add_command(info)

# pylint: disable=no-value-for-parameter
if __name__ == "__main__":
Expand Down