522#define EC_COMP_FOREACH(item, comp, type) \
523 for (item = ec_comp_iter_first(comp, type); item != NULL; \
524 item = ec_comp_iter_next(item, type))
const struct ec_comp_group * ec_comp_item_get_grp(const struct ec_comp_item *item)
Get the group of a completion item.
const struct ec_node * ec_comp_group_get_node(const struct ec_comp_group *grp)
Get the completion group node.
struct ec_strvec * ec_complete_strvec_expand(const struct ec_node *node, enum ec_comp_type type, const struct ec_strvec *strvec)
Return a new string vector based on the provided one using completion to expand non-ambiguous tokens ...
struct ec_comp_item * ec_comp_iter_next(struct ec_comp_item *item, enum ec_comp_type type)
Get the next completion item matching the type.
void ec_comp_dump(FILE *out, const struct ec_comp *comp)
Dump the content of a completions list.
const char * ec_comp_item_get_completion(const struct ec_comp_item *item)
Get the completion string value of a completion item.
int ec_complete_child(const struct ec_node *node, struct ec_comp *comp, const struct ec_strvec *strvec)
Get the list of completions of a child node.
struct ec_comp_group * ec_comp_get_cur_group(const struct ec_comp *comp)
Get current completion group.
struct ec_dict * ec_comp_get_attrs(const struct ec_comp *comp)
Get completion attributes.
int ec_comp_item_set_display(struct ec_comp_item *item, const char *display)
Set the display value of an item.
const struct ec_pnode * ec_comp_group_get_pstate(const struct ec_comp_group *grp)
Get the completion group parsing state.
struct ec_comp * ec_comp(void)
Create an empty completion object (list of completion items).
struct ec_comp * ec_complete(const struct ec_node *node, const char *str)
Get the list of completions from a string input.
const struct ec_dict * ec_comp_group_get_attrs(const struct ec_comp_group *grp)
Get the completion group attributes.
struct ec_comp_item * ec_comp_iter_first(const struct ec_comp *comp, enum ec_comp_type type)
Get the first completion item matching the type.
int ec_complete_unknown(const struct ec_node *node, struct ec_comp *comp, const struct ec_strvec *strvec)
Default node completion callback.
const char * ec_comp_item_get_display(const struct ec_comp_item *item)
Get the display string value of a completion item.
const struct ec_node * ec_comp_item_get_node(const struct ec_comp_item *item)
Get the node associated with a completion item.
struct ec_comp * ec_complete_strvec(const struct ec_node *node, const struct ec_strvec *strvec)
Get the list of completions from a string vector input.
size_t ec_comp_count(const struct ec_comp *comp, enum ec_comp_type type)
Get the number of completion items.
void ec_comp_free(struct ec_comp *comp)
Free a completion object and all its items.
struct ec_comp_item * ec_comp_add_item(struct ec_comp *comp, const struct ec_node *node, enum ec_comp_type type, const char *current, const char *full)
Add an item in completion list.
ec_comp_type
Completion item type.
struct ec_pnode * ec_comp_get_cur_pstate(const struct ec_comp *comp)
Get current parsing state of completion.
int ec_comp_merge(struct ec_comp *to, struct ec_comp *from)
Merge items contained in from into to.
const char * ec_comp_item_get_current(const struct ec_comp_item *item)
Get the current string value (before completion) of a completion item.
int ec_comp_item_set_completion(struct ec_comp_item *item, const char *completion)
Set the completion value of an item.
int ec_comp_item_set_str(struct ec_comp_item *item, const char *str)
Set the completion item string.
const char * ec_comp_item_get_str(const struct ec_comp_item *item)
Get the string value of a completion item.
enum ec_comp_type ec_comp_item_get_type(const struct ec_comp_item *item)
Get the type of a completion item.
@ EC_COMP_FULL
The item is fully completed.
@ EC_COMP_PARTIAL
The item is partially completed.
@ EC_COMP_UNKNOWN
Valid token but completion not possible.
@ EC_COMP_ALL
All completion types.
struct ec_dict * ec_dict(void)
Create a hash table.
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.
struct ec_strvec * ec_strvec(void)
Allocate a new empty string vector.