47b882f634
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.
25 lines
651 B
Python
25 lines
651 B
Python
"""list: list available agents or active bottles."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import argparse
|
|
|
|
from ..bottles import get_bottle_platform
|
|
from ..manifest import Manifest
|
|
from ._common import PROG, USER_CWD
|
|
|
|
|
|
def cmd_list(argv: list[str]) -> int:
|
|
parser = argparse.ArgumentParser(prog=f"{PROG} list", add_help=True)
|
|
parser.add_argument("scope", choices=["available", "active"])
|
|
args = parser.parse_args(argv)
|
|
|
|
if args.scope == "available":
|
|
manifest = Manifest.resolve(USER_CWD)
|
|
for name in manifest.agents.keys():
|
|
print(name)
|
|
return 0
|
|
|
|
get_bottle_platform().list_active()
|
|
return 0
|