From a2690dc1e70999962cf1faf5083ac5fcbfc8c407 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Fri, 9 Jun 2023 14:24:13 -0400 Subject: [PATCH] Add better help on what tracing destinations exist --- examples/chip-tool/commands/common/CHIPCommand.h | 3 ++- examples/common/tracing/TracingCommandLineArgument.h | 5 +++++ examples/minimal-mdns/advertiser.cpp | 2 +- examples/minimal-mdns/client.cpp | 2 +- examples/minimal-mdns/server.cpp | 2 +- src/lib/address_resolve/tool.cpp | 2 +- 6 files changed, 11 insertions(+), 5 deletions(-) diff --git a/examples/chip-tool/commands/common/CHIPCommand.h b/examples/chip-tool/commands/common/CHIPCommand.h index 624dd79a255bb0..42a00c7a3d989a 100644 --- a/examples/chip-tool/commands/common/CHIPCommand.h +++ b/examples/chip-tool/commands/common/CHIPCommand.h @@ -24,6 +24,7 @@ #include "Command.h" +#include #include #include #include @@ -85,7 +86,7 @@ class CHIPCommand : public Command AddArgument("trace_log", 0, 1, &mTraceLog); AddArgument("trace_decode", 0, 1, &mTraceDecode); #endif // CHIP_CONFIG_TRANSPORT_TRACE_ENABLED - AddArgument("trace-to", &mTraceTo, "Trace destinations, comma-separated (e.g. log)"); + AddArgument("trace-to", &mTraceTo, "Trace destinations, comma-separated (" SUPPORTED_COMMAND_LINE_TRACING_TARGETS ")"); AddArgument("ble-adapter", 0, UINT16_MAX, &mBleAdapterId); AddArgument("storage-directory", &mStorageDirectory, "Directory to place chip-tool's storage files in. Defaults to $TMPDIR, with fallback to /tmp"); diff --git a/examples/common/tracing/TracingCommandLineArgument.h b/examples/common/tracing/TracingCommandLineArgument.h index ded75d69ae30c9..c33cca690b2c91 100644 --- a/examples/common/tracing/TracingCommandLineArgument.h +++ b/examples/common/tracing/TracingCommandLineArgument.h @@ -17,9 +17,14 @@ */ #pragma once +/// A string with supported command line tracing targets +/// to be pretty-printed in help strings if needed +#define SUPPORTED_COMMAND_LINE_TRACING_TARGETS "log" + namespace chip { namespace CommandLineApp { + /// Enable tracing based on the given command line argument /// like "log" or "log,perfetto" or similar /// diff --git a/examples/minimal-mdns/advertiser.cpp b/examples/minimal-mdns/advertiser.cpp index 6684de060f95d0..0194a3d7fb4c9a 100644 --- a/examples/minimal-mdns/advertiser.cpp +++ b/examples/minimal-mdns/advertiser.cpp @@ -236,7 +236,7 @@ OptionSet cmdLineOptions = { HandleOptions, cmdLineOptionsDef, "PROGRAM OPTIONS" " Operational node id.\n" " -t \n" " --trace-to \n" - " trace to the given destination.\n" + " trace to the given destination (supported: " SUPPORTED_COMMAND_LINE_TRACING_TARGETS ").\n" "\n" }; HelpOptions helpOptions("advertiser", "Usage: advertiser [options]", "1.0"); diff --git a/examples/minimal-mdns/client.cpp b/examples/minimal-mdns/client.cpp index 121ddbadbf32f6..b342c330673b20 100644 --- a/examples/minimal-mdns/client.cpp +++ b/examples/minimal-mdns/client.cpp @@ -170,7 +170,7 @@ OptionSet cmdLineOptions = { HandleOptions, cmdLineOptionsDef, "PROGRAM OPTIONS" " --multicast-reply\n" " Do not request unicast replies\n" " --trace-to \n" - " trace to the given destination.\n" + " trace to the given destination (supported: " SUPPORTED_COMMAND_LINE_TRACING_TARGETS ").\n" "\n" }; HelpOptions helpOptions("minimal-mdns-client", "Usage: minimal-mdns-client [options]", "1.0"); diff --git a/examples/minimal-mdns/server.cpp b/examples/minimal-mdns/server.cpp index c329e851c903d9..1f51b1da9bbdb1 100644 --- a/examples/minimal-mdns/server.cpp +++ b/examples/minimal-mdns/server.cpp @@ -109,7 +109,7 @@ OptionSet cmdLineOptions = { HandleOptions, cmdLineOptionsDef, "PROGRAM OPTIONS" " instance name to advertise.\n" " -t \n" " --trace-to \n" - " trace to the given destination.\n" + " trace to the given destination (supported: " SUPPORTED_COMMAND_LINE_TRACING_TARGETS ").\n" "\n" }; HelpOptions helpOptions("minimal-mdns-server", "Usage: minimal-mdns-server [options]", "1.0"); diff --git a/src/lib/address_resolve/tool.cpp b/src/lib/address_resolve/tool.cpp index 4ada0aa11bf152..c55733f42a6293 100644 --- a/src/lib/address_resolve/tool.cpp +++ b/src/lib/address_resolve/tool.cpp @@ -45,7 +45,7 @@ const char * const sHelp = "Usage: address-resolve-tool [] [ ]\n" "\n" "Options:\n" - " --trace-to -- Trace to the given destination\n" + " --trace-to -- Trace to the given destination (" SUPPORTED_COMMAND_LINE_TRACING_TARGETS ")\n" "Commands:\n" "\n" " node -- Find the node for the given node/fabric.\n"