Fix aos_send
Change-Id: I202d7931a3daca7ed9958b4dc8aed46061c70352
Signed-off-by: Austin Schuh <austin.schuh@bluerivertech.com>
diff --git a/aos/aos_cli_utils.cc b/aos/aos_cli_utils.cc
index 56210ee..84ba1e4 100644
--- a/aos/aos_cli_utils.cc
+++ b/aos/aos_cli_utils.cc
@@ -32,7 +32,8 @@
bool CliUtilInfo::Initialize(
int *argc, char ***argv,
- std::function<bool(const aos::Channel *)> channel_filter) {
+ std::function<bool(const aos::Channel *)> channel_filter,
+ bool expect_args) {
// Don't generate failure output if the config doesn't exist while attempting
// to autocomplete.
if (struct stat file_stat;
@@ -113,7 +114,7 @@
for (const aos::Channel *channel : found_channels_now) {
found_channels.push_back(channel);
}
- } while (*argc > 1);
+ } while (expect_args && *argc > 1);
return false;
}
diff --git a/aos/aos_cli_utils.h b/aos/aos_cli_utils.h
index e158737..962e0a0 100644
--- a/aos/aos_cli_utils.h
+++ b/aos/aos_cli_utils.h
@@ -13,7 +13,8 @@
// If this returns false, the other fields will be filled out appropriately.
// event_loop will be filled out before channel_filter is called.
bool Initialize(int *argc, char ***argv,
- std::function<bool(const aos::Channel *)> channel_filter);
+ std::function<bool(const aos::Channel *)> channel_filter,
+ bool expect_args);
std::optional<aos::FlatbufferDetachedBuffer<aos::Configuration>> config;
std::optional<aos::ShmEventLoop> event_loop;
diff --git a/aos/aos_dump.cc b/aos/aos_dump.cc
index e2467b3..477b6fb 100644
--- a/aos/aos_dump.cc
+++ b/aos/aos_dump.cc
@@ -70,11 +70,13 @@
aos::InitGoogle(&argc, &argv);
aos::CliUtilInfo cli_info;
- if (cli_info.Initialize(&argc, &argv,
- [&cli_info](const aos::Channel *channel) {
- return aos::configuration::ChannelIsReadableOnNode(
- channel, cli_info.event_loop->node());
- })) {
+ if (cli_info.Initialize(
+ &argc, &argv,
+ [&cli_info](const aos::Channel *channel) {
+ return aos::configuration::ChannelIsReadableOnNode(
+ channel, cli_info.event_loop->node());
+ },
+ true)) {
return 0;
}
diff --git a/aos/aos_send.cc b/aos/aos_send.cc
index d94418a..91ffb1c 100644
--- a/aos/aos_send.cc
+++ b/aos/aos_send.cc
@@ -19,11 +19,13 @@
aos::InitGoogle(&argc, &argv);
aos::CliUtilInfo cli_info;
- if (cli_info.Initialize(&argc, &argv,
- [&cli_info](const aos::Channel *channel) {
- return aos::configuration::ChannelIsSendableOnNode(
- channel, cli_info.event_loop->node());
- })) {
+ if (cli_info.Initialize(
+ &argc, &argv,
+ [&cli_info](const aos::Channel *channel) {
+ return aos::configuration::ChannelIsSendableOnNode(
+ channel, cli_info.event_loop->node());
+ },
+ false)) {
return 0;
}
if (cli_info.found_channels.size() > 1) {