* @brief Sets a custom error handler for the CLI parser. * * This function allows the user to specify a custom error handler function that will be called whenever * an error occurs during parsing. The custom handler can be used to provide custom error messages or * perform specific error handling actions. * * @param parser A pointer to the `CliParser` instance. Must not be NULL. * @param ha
| 295 | cli_last_error.code = CLI_SUCCESS; |
| 296 | |
| 297 | CLI_LOG("[cli_parser_deallocate] %s", cli_last_error.message); |
| 298 | } |
| 299 | |
| 300 | |
| 301 | /** |
| 302 | * @brief Sets a custom usage message for the CLI parser. |
| 303 | * |
| 304 | * This function allows the user to set a custom usage message that will be displayed |
| 305 | * when help information is printed. The custom usage message overrides the default |
| 306 | * generated message. |
| 307 | * |
| 308 | * @param parser A pointer to the `CliParser` instance. Must not be NULL. |
| 309 | * @param usage A string containing the custom usage message. Must not be NULL. |
| 310 | * |
| 311 | * @return void |
| 312 | * @note If the `parser` or `usage` is NULL, an error is logged and the function returns without setting the usage message. |
| 313 | */ |
| 314 | void cli_set_custom_usage(CliParser *parser, const char *usage) { |
| 315 | if (parser == NULL || usage == NULL) { |
| 316 | snprintf(cli_last_error.message, sizeof(cli_last_error.message), "Error: NULL argument provided to cli_set_custom_usage.\n"); |
nothing calls this directly
no outgoing calls
no test coverage detected