feat: Add crewai install CLI command (#1203)

* feat: Add crewai install CLI command

* feat: Add crewai install to the docs and force now crewai run
This commit is contained in:
Eduardo Chiarotti
2024-08-17 08:41:53 -03:00
committed by GitHub
parent ddda8f6bda
commit 231a833ad0
7 changed files with 38 additions and 37 deletions

View File

@@ -0,0 +1,21 @@
import subprocess
import click
def install_crew() -> None:
"""
Install the crew by running the Poetry command to lock and install.
"""
try:
subprocess.run(["poetry", "lock"], check=True, capture_output=False, text=True)
subprocess.run(
["poetry", "install"], check=True, capture_output=False, text=True
)
except subprocess.CalledProcessError as e:
click.echo(f"An error occurred while running the crew: {e}", err=True)
click.echo(e.output, err=True)
except Exception as e:
click.echo(f"An unexpected error occurred: {e}", err=True)