Refactor starter_cmd a bit
This patch switches the order of arguments for starter_cmd. In
particular, the subcommand now comes first and then you specify the
name of the application.
For example:
$ starter_cmd start <app>
$ starter_cmd stop <app>
$ starter_cmd status <app>
This patch also enhances the "status" command to work without any
arguments. In this case, it will print out a high-level status for all
applications.
The error reporting on incorrect arguments to starter_cmd should also
be quite a bit improved with this change.
Change-Id: I4c80e6662b6f3d3e630a4be26d579e1166a89643
diff --git a/aos/starter/starter_rpc_lib.cc b/aos/starter/starter_rpc_lib.cc
index efb4042..89fc2c2 100644
--- a/aos/starter/starter_rpc_lib.cc
+++ b/aos/starter/starter_rpc_lib.cc
@@ -127,5 +127,19 @@
aos::starter::ApplicationStatus>::Empty();
}
+const aos::FlatbufferVector<aos::starter::Status> GetStarterStatus(
+ const aos::Configuration *config) {
+ ShmEventLoop event_loop(config);
+ event_loop.SkipAosLog();
+
+ auto status_fetcher = event_loop.MakeFetcher<aos::starter::Status>("/aos");
+ status_fetcher.Fetch();
+ if (status_fetcher) {
+ return status_fetcher.CopyFlatBuffer();
+ } else {
+ return FlatbufferVector<aos::starter::Status>::Empty();
+ }
+}
+
} // namespace starter
} // namespace aos