Libecoli
0.11.5
Extensible COmmand LIne library
Toggle main menu visibility
Loading...
Searching...
No Matches
interact.h
1
/* SPDX-License-Identifier: BSD-3-Clause
2
* Copyright 2025, Olivier MATZ <zer0@droids-corp.org>
3
*/
4
11
12
#pragma once
13
14
#include <stdbool.h>
15
#include <stdio.h>
16
17
#include "complete.h"
18
19
struct
ec_node
;
20
struct
ec_pnode
;
21
struct
ec_comp
;
22
26
struct
ec_interact_help
{
27
char
*desc;
28
char
*help;
29
};
30
34
#define EC_INTERACT_HELP_ATTR "_help"
35
39
#define EC_INTERACT_CB_ATTR "_cb"
40
44
#define EC_INTERACT_DESC_ATTR "_desc"
45
49
typedef
int (*
ec_interact_command_cb_t
)(
const
struct
ec_pnode
*);
50
63
ssize_t
ec_interact_get_completions
(
64
const
struct
ec_comp
*cmpl,
65
char
***matches_out,
66
enum
ec_comp_type
type_mask
67
);
68
77
void
ec_interact_free_completions
(
char
**matches,
size_t
n);
78
93
int
ec_interact_print_cols
(FILE *out,
unsigned
int
width,
char
const
*
const
*matches,
size_t
n);
94
106
char
*
ec_interact_append_chars
(
const
struct
ec_comp
*cmpl);
107
120
ssize_t
ec_interact_get_helps
(
121
const
struct
ec_node
*node,
122
const
char
*line,
123
struct
ec_interact_help
**helps_out
124
);
125
140
int
ec_interact_print_helps
(
141
FILE *out,
142
unsigned
int
width,
143
const
struct
ec_interact_help
*helps,
144
size_t
n
145
);
146
158
void
ec_interact_free_helps
(
struct
ec_interact_help
*helps,
size_t
n);
159
175
ssize_t
ec_interact_get_error_helps
(
176
const
struct
ec_node
*node,
177
const
char
*line,
178
struct
ec_interact_help
**helps_out,
179
size_t
*char_idx
180
);
181
200
int
ec_interact_print_error_helps
(
201
FILE *out,
202
unsigned
int
width,
203
const
char
*line,
204
const
struct
ec_interact_help
*helps,
205
size_t
n,
206
size_t
char_idx
207
);
208
223
int
ec_interact_set_help
(
struct
ec_node
*node,
const
char
*help);
224
238
int
ec_interact_set_callback
(
struct
ec_node
*node,
ec_interact_command_cb_t
cb);
239
255
int
ec_interact_set_desc
(
struct
ec_node
*node,
const
char
*desc);
256
269
ec_interact_command_cb_t
ec_interact_get_callback
(
struct
ec_pnode
*parse);
270
ec_comp
struct ec_comp * ec_comp(void)
ec_comp_type
ec_comp_type
Definition
complete.h:47
ec_interact_get_error_helps
ssize_t ec_interact_get_error_helps(const struct ec_node *node, const char *line, struct ec_interact_help **helps_out, size_t *char_idx)
ec_interact_command_cb_t
int(* ec_interact_command_cb_t)(const struct ec_pnode *)
Definition
interact.h:49
ec_interact_print_error_helps
int ec_interact_print_error_helps(FILE *out, unsigned int width, const char *line, const struct ec_interact_help *helps, size_t n, size_t char_idx)
ec_interact_set_help
int ec_interact_set_help(struct ec_node *node, const char *help)
ec_interact_print_helps
int ec_interact_print_helps(FILE *out, unsigned int width, const struct ec_interact_help *helps, size_t n)
ec_interact_set_desc
int ec_interact_set_desc(struct ec_node *node, const char *desc)
ec_interact_get_completions
ssize_t ec_interact_get_completions(const struct ec_comp *cmpl, char ***matches_out, enum ec_comp_type type_mask)
ec_interact_get_helps
ssize_t ec_interact_get_helps(const struct ec_node *node, const char *line, struct ec_interact_help **helps_out)
ec_interact_set_callback
int ec_interact_set_callback(struct ec_node *node, ec_interact_command_cb_t cb)
ec_interact_get_callback
ec_interact_command_cb_t ec_interact_get_callback(struct ec_pnode *parse)
ec_interact_print_cols
int ec_interact_print_cols(FILE *out, unsigned int width, char const *const *matches, size_t n)
ec_interact_append_chars
char * ec_interact_append_chars(const struct ec_comp *cmpl)
ec_interact_free_helps
void ec_interact_free_helps(struct ec_interact_help *helps, size_t n)
ec_interact_free_completions
void ec_interact_free_completions(char **matches, size_t n)
ec_node
struct ec_node * ec_node(const char *typename, const char *id)
ec_pnode
struct ec_pnode * ec_pnode(const struct ec_node *node)
ec_interact_help
Definition
interact.h:26
ecoli
interact.h
Generated by
1.17.0