refactor(bottles): move 'list active' onto DockerBottlePlatform
test / run tests/run_tests.py (pull_request) Successful in 14s
test / run tests/run_tests.py (pull_request) Successful in 14s
Add list_active() abstract method on BottlePlatform; DockerBottlePlatform implements it with the existing docker ps logic. cli/list.py no longer calls docker directly — it just dispatches the active branch to the platform.
This commit is contained in:
@@ -527,3 +527,28 @@ class DockerBottlePlatform(BottlePlatform):
|
||||
stdout=subprocess.DEVNULL,
|
||||
stderr=subprocess.DEVNULL,
|
||||
)
|
||||
|
||||
# --- List ---
|
||||
|
||||
def list_active(self) -> None:
|
||||
"""Print all running claude-bottle containers (name + status).
|
||||
Prints a single-line banner if there are none."""
|
||||
docker_mod.require_docker()
|
||||
result = subprocess.run(
|
||||
[
|
||||
"docker", "ps",
|
||||
"--filter", "name=^claude-bottle-",
|
||||
"--format", "{{.Names}}\t{{.Status}}",
|
||||
],
|
||||
capture_output=True,
|
||||
text=True,
|
||||
)
|
||||
containers = (result.stdout or "").strip()
|
||||
if not containers:
|
||||
info("no active claude-bottle containers")
|
||||
return
|
||||
print()
|
||||
for line in containers.splitlines():
|
||||
name, _, status = line.partition("\t")
|
||||
info(f"container: {name} status: {status}")
|
||||
print()
|
||||
|
||||
Reference in New Issue
Block a user