Skip to content

Commit

Permalink
Add --version option to CLI
Browse files Browse the repository at this point in the history
- Imported pkg_resources to fetch the version of the installed package.
- Added @click.version_option decorator.
- The --version option prints the version of the devchat package.
- Added setuptools to the project dependencies.
  • Loading branch information
basicthinker committed Jul 17, 2023
1 parent 019d1e9 commit 8aa0f4d
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
3 changes: 3 additions & 0 deletions devchat/_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import os
import sys
from typing import List, Optional, Tuple
import pkg_resources
import rich_click as click
from devchat.store import Store
from devchat.openai import OpenAIChatConfig, OpenAIChat
Expand All @@ -18,6 +19,8 @@


@click.group()
@click.version_option(pkg_resources.get_distribution("devchat").version, '--version', '-v',
message='DevChat %(version)s')
def main():
"""DevChat CLI: A command-line interface for DevChat."""

Expand Down
18 changes: 17 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ rich_click = "^1.6.1"
tiktoken = "^0.4.0"
tinydb = "^4.7.1"
urllib3 = "<2.0"
setuptools = "^68.0.0"

[tool.poetry.scripts]
devchat = "devchat._cli:main"
Expand Down

0 comments on commit 8aa0f4d

Please sign in to comment.