Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show command help text in chip-tool cluster listings. #25825

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions examples/chip-tool/commands/common/Commands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,23 @@ void Commands::ShowCluster(std::string executable, std::string clusterName, Comm
if (shouldPrint)
{
fprintf(stderr, " | * %-82s|\n", command->GetName());
const char * helpText = command->GetHelpText();
if (command->GetHelpText())
{
// We leave 82 chars for command names. The help text starts
// two chars further to the right, so there are 80 chars left
// for it.
if (strlen(helpText) > 80)
{
// Add "..." at the end to indicate truncation, and only
// show the first 77 chars, since that's what will fit.
fprintf(stderr, " | - %.77s...|\n", helpText);
}
else
{
fprintf(stderr, " | - %-80s|\n", helpText);
}
}
}
}
fprintf(stderr, " +-------------------------------------------------------------------------------------+\n");
Expand Down
4 changes: 2 additions & 2 deletions examples/chip-tool/commands/pairing/CloseSessionCommand.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ class CloseSessionCommand : public CHIPCommand
{
public:
CloseSessionCommand(CredentialIssuerCommands * credIssuerCommands) :
CHIPCommand("close-session", credIssuerCommands), mOnDeviceConnectedCallback(OnDeviceConnectedFn, this),
mOnDeviceConnectionFailureCallback(OnDeviceConnectionFailureFn, this)
CHIPCommand("close-session", credIssuerCommands, "Sends a CloseSession message to the given destination node id."),
mOnDeviceConnectedCallback(OnDeviceConnectedFn, this), mOnDeviceConnectionFailureCallback(OnDeviceConnectionFailureFn, this)
{
AddArgument("destination-id", 0, UINT64_MAX, &mDestinationId);
AddArgument("timeout", 0, UINT64_MAX, &mTimeoutSecs,
Expand Down