EC_COMP_ADD_ITEM(3)

πŸ“¦
version 0.11.7 Β· 5 versions
, in fedora 44

πŸ’– EC_COMP_ADD_ITEM(3) πŸ’–

okay bestie, welcome to the Libecoli Programmer's Manual β€” today's episode is all about ec_comp_add_item, and honestly? it's giving completion-list royalty ✨


🌸 NAME 🌸

ec_comp_add_item β€” drop a lil item into the completion list πŸŽ€


✨ SYNOPSIS ✨

#include <ecoli/complete.h>

struct ec_comp_item * ec_comp_add_item(
    struct ec_comp         *comp,     /* The current completion list. */
    const struct ec_node   *node,     /* The node issuing the completion item. */
    enum ec_comp_type       type,     /* The type of the item. */
    const char             *current,  /* The incomplete string being completed. */
    const char             *full      /* The string fully completed. */
);

πŸ’… DESCRIPTION πŸ’…

so basically, this is the function a node calls during the completion process β€” once for every single completion item that should get added to the list. no cap. the nodes that do this are typically the terminal ones, like ec_node_str() or ec_node_file(). they're the ones on the front lines fr fr 🫢

what it does: creates a brand new completion item and yeets it straight into the completion list. and every completion item has a type, which can be… πŸ‘€ (scroll down to STRUCTURES bestie, we got you)


πŸ¦‹ STRUCTURES πŸ¦‹

the type menu, fresh off the press:

enum ec_comp_type {
      EC_COMP_UNKNOWN;
      EC_COMP_FULL;
      EC_COMP_PARTIAL;
      EC_COMP_ALL;
};

πŸ‘‘ RETURN VALUE πŸ‘‘

on success you get back the item that was added to the list. on error? you get NULL. 😭

do NOT free the returned value, bestie. it's referenced by the completion list, so it's not yours to delete, periodt. πŸ’€

it gets returned to you anyway, in case you need to modify it β€” for instance with ec_comp_item_set_display(). iconic behavior tbh.


🌈 SEE ALSO 🌈

the whole friend group, all invited to the group chat:


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


and that's the whole page, bestie πŸ“ this lil manual moment comes to you courtesy of libecoli, dated 2026-06-11, and it lives at EC_COMP_ADD_ITEM(3). mwah πŸ’‹ go forth and complete some strings ✨🧚

πŸ“¦ where this page comes from