Files
ESP32_Serial_Swiss_Army_Knife/src/console_completion.h
T

40 lines
1.3 KiB
C

/* SPDX-License-Identifier: GPL-3.0-only */
#pragma once
#include <stdbool.h>
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Current longest formatted match list is below this; overflow fails closed. */
#define CONSOLE_COMPLETION_OUTPUT_CAPACITY 1024U
/* Install late-terminal upgrade handling and project-specific completion. */
void console_completion_install(void);
typedef bool (*console_completion_visitor_t)(const char *candidate, void *context);
/* Visit the same matching hint candidates used by both UART0 and admin SSH. */
void console_completion_visit(const char *line,
console_completion_visitor_t visitor,
void *context);
/* Bounded longest-prefix completion shared by the UART and admin SSH frontends. */
bool console_completion_expand(const char *line, char *completed, size_t capacity);
/*
* Format the matching candidates as CRLF-terminated lines for a frontend that
* cannot use linenoise's native completion display. A successful empty result
* means no candidate matched; false means the supplied output buffer was too
* small or an argument was invalid.
*/
bool console_completion_format_matches(const char *line, char *output, size_t capacity,
size_t *output_length);
#ifdef __cplusplus
}
#endif