Skip to content
Closed
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ classifiers = [
Homepage = "https://github.com/browserbase/sdk-python"
Repository = "https://github.com/browserbase/sdk-python"


[project.scripts]
browserbase = "browserbase.cli:main"

[tool.rye]
managed = true
Expand Down
29 changes: 29 additions & 0 deletions src/browserbase/cli.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import sys
import subprocess
from typing import List, Optional


def main(args: Optional[List[str]] = None) -> int:
if args is None:
args = sys.argv[1:]

if not args:
print("Usage: browserbase <command>")
return 1

# Execute the command
try:
# Join arguments into a single string for shell execution
cmd = " ".join(args)
result = subprocess.run(cmd, shell=True, check=True)
return result.returncode
except subprocess.CalledProcessError as e:
print(f"Command failed with exit code {e.returncode}")
return e.returncode
except FileNotFoundError:
print(f"Command not found: {args[0]}")
return 127


if __name__ == "__main__":
sys.exit(main())
Loading