Skip to content
Open
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
19 changes: 13 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,23 @@ pip install sprites-py

```python
from sprites import SpritesClient
from sprites.exec import run

# Create a client
client = SpritesClient(token="your-token")

# Create a sprite
sprite_name = "my-sprite"
client.create_sprite(sprite_name)

# Get a sprite handle
sprite = client.sprite("my-sprite")
sprite = client.sprite(sprite_name)

# Run a command
result = sprite.run("echo", "hello", capture_output=True)
# Run a command using the standalone run() function
result = run(sprite, "echo", "hello", capture_output=True)
print(result.stdout.decode()) # "hello\n"

# Or use the Go-style API
# Or use the Go-style API (recommended)
cmd = sprite.command("ls", "-la")
output = cmd.output()
print(output.decode())
Expand Down Expand Up @@ -55,12 +60,14 @@ client.delete_sprite("my-sprite")
### Sprite

```python
from sprites.exec import run

# Run a command (subprocess.run style)
result = sprite.run("echo", "hello", capture_output=True, timeout=30)
result = run(sprite, "echo", "hello", capture_output=True, timeout=30)
print(result.returncode)
print(result.stdout)

# Create a command (Go exec.Cmd style)
# Create a command (Go exec.Cmd style - recommended)
cmd = sprite.command("bash", "-c", "echo hello")
output = cmd.output() # Returns stdout
combined = cmd.combined_output() # Returns stdout + stderr
Expand Down