31#define EC_EDITLINE_HISTORY_SIZE 128
336#define EC_EDITLINE_HELP_ATTR EC_DEPRECATED_MACRO("use EC_INTERACT_HELP_ATTR") EC_INTERACT_HELP_ATTR
337#define EC_EDITLINE_CB_ATTR EC_DEPRECATED_MACRO("use EC_INTERACT_CB_ATTR") EC_INTERACT_CB_ATTR
338#define EC_EDITLINE_DESC_ATTR EC_DEPRECATED_MACRO("use EC_INTERACT_DESC_ATTR") EC_INTERACT_DESC_ATTR
340struct EC_DEPRECATED(
"use struct ec_interact_help") ec_editline_help {
346 ec_editline_command_cb_t
EC_DEPRECATED(
"use ec_interact_command_cb_t");
352#pragma GCC diagnostic push
353#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
356ec_editline_get_completions(const struct
ec_comp *cmpl,
char ***matches_out);
359void ec_editline_free_completions(
char **matches,
size_t n);
362int ec_editline_print_cols(struct
ec_editline *editline,
char const *const *matches,
size_t n);
365char *ec_editline_append_chars(const struct
ec_comp *cmpl);
367EC_DEPRECATED(
"use ec_interact_get_helps") ssize_t ec_editline_get_helps(
370 struct ec_editline_help **helps_out
374int ec_editline_print_helps(
376 const struct ec_editline_help *helps,
381void ec_editline_free_helps(struct ec_editline_help *helps,
size_t n);
383EC_DEPRECATED(
"use ec_interact_get_error_helps") ssize_t ec_editline_get_error_helps(
385 struct ec_editline_help **helps_out,
390int ec_editline_print_error_helps(
392 const struct ec_editline_help *helps,
398int ec_editline_set_help(struct
ec_node *node, const
char *help);
404int ec_editline_set_desc(struct
ec_node *node, const
char *desc);
406#pragma GCC diagnostic pop
struct ec_comp * ec_comp(void)
Create an empty completion object (list of completion items).
int ec_editline_set_prompt(struct ec_editline *editline, const char *prompt)
Set editline prompt.
struct ec_editline * ec_editline(const char *prog, FILE *f_in, FILE *f_out, FILE *f_err, enum ec_editline_init_flags flags)
Create an editline instance with default behavior.
int ec_editline_set_prompt_esc(struct ec_editline *editline, const char *prompt, char delim)
Set editline escaped prompt.
const struct ec_node * ec_editline_get_node(const struct ec_editline *editline)
Return the ecoli node attached to the editline structure.
void ec_editline_free(struct ec_editline *editline)
Free an editline structure allocated with ec_editline().
struct ec_pnode * ec_editline_parse(struct ec_editline *editline)
Get a line interactively (with completion), and parse it.
int(* ec_editline_check_exit_cb_t)(void *opaque)
Type of callback invoked by ec_editline_interact() to check if loop should exit (when the function re...
struct editline * ec_editline_get_el(struct ec_editline *editline)
Return the wrapped editline instance attached to the ec_editline structure.
int ec_editline_term_size(const struct ec_editline *editline, unsigned int *width, unsigned int *height)
Get terminal width and height.
int ec_editline_complete(struct editline *el, int c)
Default completion callback used by editline.
int ec_editline_interact(struct ec_editline *editline, ec_editline_check_exit_cb_t check_exit_cb, void *opaque)
Interact with the user until exit.
ec_editline_init_flags
Flags passed at ec_editline initialization.
int ec_editline_set_node(struct ec_editline *editline, const struct ec_node *node)
Attach an ecoli node to the editline structure.
char * ec_editline_gets(struct ec_editline *editline)
Get a line interactively (with completion).
int ec_editline_set_history(struct ec_editline *editline, size_t hist_size, const char *hist_file)
Change the history size.
char * ec_editline_curline(const struct ec_editline *editline, bool trim_after_cursor)
Get the current edited line.
@ EC_EDITLINE_DISABLE_COMPLETION
Disable completion.
@ EC_EDITLINE_DISABLE_SIGNALS
Ask the terminal to not send signals (STOP, SUSPEND, ...).
@ EC_EDITLINE_DEFAULT_SIGHANDLER
Use editline own signal handler for the following signals when reading command input: SIGCONT,...
@ EC_EDITLINE_DISABLE_HISTORY
Disable history.
int(* ec_interact_command_cb_t)(const struct ec_pnode *)
Type of callback attached with EC_INTERACT_CB_ATTR attribute.
struct ec_node * ec_node(const char *typename, const char *id)
Create a new node from its type name.
struct ec_pnode * ec_pnode(const struct ec_node *node)
Create an empty parsing tree.
#define EC_DEPRECATED(msg)
Mark a function or type as deprecated.