Add --list-containers to list compose-started containers
list_compose_containers() (compose_orchestrator.{h,cpp}) scans every
compose state file under xdg_state_dir()/"compose"/ and reports one row
per recorded service: compose file, service, container name, pid, and a
real liveness status cross-referenced against list_sessions() -- not just
"this line exists in the state file". record_compose_services() now also
writes the compose file's own real path as a header line, since the state
file's own name only encodes a lossy, sanitized version of it.
commands.cpp's own pad_column() factors out the per-column tab-alignment
scheme every other list command in this file already duplicates inline,
since this one needs it across four columns.
Verified manually: --list-containers against a real running 2-service
compose stack shows both running with correct fields; killing one flips
just that row to exited on a re-run, confirming real liveness checking.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Gv3s5jckJKzh6JkMoi2Akz
This commit is contained in:
@@ -294,3 +294,9 @@ TEST_CASE("parse_args: -u and -d together on the same command line is a parse er
|
||||
REQUIRE(result.exit_code.has_value());
|
||||
CHECK(*result.exit_code == 1);
|
||||
}
|
||||
|
||||
TEST_CASE("parse_args: --list-containers selects Mode::list_containers", "[unit]") {
|
||||
auto result = run_parse({"--list-containers"});
|
||||
REQUIRE_FALSE(result.exit_code.has_value());
|
||||
CHECK(result.args.mode == Mode::list_containers);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user