mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-10 08:38:30 +00:00
add in --version flag to cli. closes #1679.
This commit is contained in:
@@ -26,6 +26,7 @@ from .update_crew import update_crew
|
|||||||
|
|
||||||
|
|
||||||
@click.group()
|
@click.group()
|
||||||
|
@click.version_option(pkg_resources.get_distribution("crewai").version)
|
||||||
def crewai():
|
def crewai():
|
||||||
"""Top-level command group for crewai."""
|
"""Top-level command group for crewai."""
|
||||||
|
|
||||||
@@ -55,7 +56,10 @@ def create(type, name, provider, skip_provider=False):
|
|||||||
)
|
)
|
||||||
def version(tools):
|
def version(tools):
|
||||||
"""Show the installed version of crewai."""
|
"""Show the installed version of crewai."""
|
||||||
|
try:
|
||||||
crewai_version = pkg_resources.get_distribution("crewai").version
|
crewai_version = pkg_resources.get_distribution("crewai").version
|
||||||
|
except Exception:
|
||||||
|
crewai_version = "unknown version"
|
||||||
click.echo(f"crewai version: {crewai_version}")
|
click.echo(f"crewai version: {crewai_version}")
|
||||||
|
|
||||||
if tools:
|
if tools:
|
||||||
|
|||||||
@@ -131,6 +131,13 @@ def test_reset_no_memory_flags(runner):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def test_version_flag(runner):
|
||||||
|
result = runner.invoke(version)
|
||||||
|
|
||||||
|
assert result.exit_code == 0
|
||||||
|
assert "crewai version:" in result.output
|
||||||
|
|
||||||
|
|
||||||
def test_version_command(runner):
|
def test_version_command(runner):
|
||||||
result = runner.invoke(version)
|
result = runner.invoke(version)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user