EC_COMPLETE_STRVEC(3)

NAME
ec_complete_strvec - Get the list of completions from a string vector input.

SYNOPSIS
#include <ecoli/complete.h>

struct ec_comp * ec_complete_strvec(
    const struct ec_node     *node,    /* The grammar graph. */
    const struct ec_strvec   *strvec   /* The input string vector. */
);

DESCRIPTION

This function tries to complete the last element of the given string vector. For instance, to complete with file names in an equivalent of the cat shell command, the passed vector should be ["cat", ""] (and not ["cat"]). To complete with files starting with "x", the passed vector should be ["cat", "x"].

To get the completion list, the engine parses the beginning of the input using the grammar graph. The resulting parsing tree is saved and attached to each completion group.

The result is a ec_comp structure pointer, which contains several groups of completion items.

RETURN VALUE

A pointer to the completion list on success, or NULL on error (errno is set).

SEE ALSO

ec_comp_add_item(3), ec_comp_count(3), ec_comp_item_set_str(3), ec_complete(3), ec_comp_get_attrs(3), ec_comp_group_get_attrs(3), ec_comp_iter_next(3), ec_comp_item_get_node(3), ec_comp_iter_first(3), ec_comp_item_get_current(3), ec_comp_group_get_node(3), ec_complete_strvec_expand(3), ec_comp_free(3), ec_comp_get_cur_pstate(3), ec_complete_unknown(3), ec_comp_item_get_grp(3), ec_comp_item_get_type(3), ec_comp_item_get_str(3), ec_comp_item_set_display(3), ec_complete_child(3), ec_comp(3), ec_comp_item_get_display(3), ec_comp_item_get_completion(3), ec_comp_group_get_pstate(3), ec_comp_dump(3), ec_comp_merge(3), ec_comp_item_set_completion(3), ec_comp_get_cur_group(3)

COPYRIGHT

Copyright (C) 2010-2026 Olivier Matz, Robin Jarry.