Skip to content

Commit 75e4340

Browse files
committed
add-pipx
1 parent d865f5e commit 75e4340

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ classifiers = [
3939
Homepage = "https://github.com/browserbase/sdk-python"
4040
Repository = "https://github.com/browserbase/sdk-python"
4141

42-
42+
[project.scripts]
43+
browserbase = "browserbase.cli:main"
4344

4445
[tool.rye]
4546
managed = true

src/browserbase/cli.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import sys
2+
import subprocess
3+
from typing import List, Optional
4+
5+
6+
def main(args: Optional[List[str]] = None) -> int:
7+
if args is None:
8+
args = sys.argv[1:]
9+
10+
if not args:
11+
print("Usage: browserbase <command>")
12+
return 1
13+
14+
# Execute the command
15+
try:
16+
result = subprocess.run(args, check=True)
17+
return result.returncode
18+
except subprocess.CalledProcessError as e:
19+
print(f"Command failed with exit code {e.returncode}")
20+
return e.returncode
21+
except FileNotFoundError:
22+
print(f"Command not found: {args[0]}")
23+
return 127
24+
25+
26+
if __name__ == "__main__":
27+
sys.exit(main())

0 commit comments

Comments
 (0)