return NULL;
line[rl_point] = '\0';
- c = ec_node_complete(commands, line);
+ c = ec_complete(commands, line);
free(line);
if (c == NULL)
return NULL;
static char *get_node_help(const struct ec_comp_item *item)
{
const struct ec_comp_group *grp;
- const struct ec_parse *state;
+ const struct ec_pnode *state;
const struct ec_node *node;
char *help = NULL;
const char *node_help = NULL;
grp = ec_comp_item_get_grp(item);
for (state = ec_comp_group_get_state(grp); state != NULL;
- state = ec_parse_get_parent(state)) {
- node = ec_parse_get_node(state);
+ state = ec_pnode_get_parent(state)) {
+ node = ec_pnode_get_node(state);
if (node_help == NULL)
node_help = ec_dict_get(ec_node_attrs(node), "help");
if (node_desc == NULL)
const struct ec_comp_group *grp, *prev_grp = NULL;
const struct ec_comp_item *item;
struct ec_comp *c = NULL;
- struct ec_parse *p = NULL;
+ struct ec_pnode *p = NULL;
char *line = NULL;
unsigned int count;
char **helps = NULL;
goto fail;
/* check if the current line matches */
- p = ec_node_parse(commands, line);
- if (ec_parse_matches(p))
+ p = ec_parse(commands, line);
+ if (ec_pnode_matches(p))
match = 1;
- ec_parse_free(p);
+ ec_pnode_free(p);
p = NULL;
/* complete at current cursor position */
line[rl_point] = '\0';
- c = ec_node_complete(commands, line);
+ c = ec_complete(commands, line);
free(line);
line = NULL;
if (c == NULL)
fail:
ec_comp_iter_free(iter);
- ec_parse_free(p);
+ ec_pnode_free(p);
free(line);
ec_comp_free(c);
if (helps != NULL) {
int main(void)
{
- struct ec_parse *p;
+ struct ec_pnode *p;
char *line;
if (ec_init() < 0) {
if (line == NULL)
break;
- p = ec_node_parse(commands, line);
- ec_parse_dump(stdout, p);
+ p = ec_parse(commands, line);
+ ec_pnode_dump(stdout, p);
add_history(line);
- ec_parse_free(p);
+ ec_pnode_free(p);
}