EC_COMPLETE_STRVEC(3)

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

✨ EC_COMPLETE_STRVEC(3) ✨

okay bestie, welcome to the Libecoli Programmer's Manual πŸ’– this one's called ec_complete_strvec and it's lowkey the moment you've been waiting for: it hands you the list of completions straight out of a string vector. no cap. πŸŽ€


🌸 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. */
);

so like, two things go in: the grammar graph (node) and the input string vector (strvec), and a struct ec_comp * comes out the other side. iconic behavior honestly πŸ’…


πŸ’œ DESCRIPTION πŸ’œ

okay so here's the tea: this function tries to complete the last element of the string vector you hand it. like, the last one. that's the whole vibe.

want a concrete example? say you're building the equivalent of the cat shell command and you want to complete with file names. the vector you pass should be ["cat", ""] β€” and not ["cat"]. yes bestie, that trailing empty string is doing real work, don't skip it πŸ™ˆ

and if you want to complete with files that start with "x", the vector you pass should be ["cat", "x"]. see how it works? the last element is the thing getting completed. periodt. 🫢

now, how does the engine actually figure out the completion list? it parses the beginning of the input using the grammar graph. then the resulting parsing tree gets saved and attached to each completion group. the way that it just... keeps the receipts for every group? obsessed. πŸ”₯

the result is a ec_comp structure pointer, and inside it lives several groups of completion items. that's your whole buffet of options right there. 🌈


⭐ RETURN VALUE ⭐

  • on success: a pointer to the completion list. slay. πŸ’–
  • on error: NULL, and errno is set. 😭 (not slay, but at least it tells you why)

πŸ‘‘ SEE ALSO πŸ‘‘

the whole friend group, fr fr β€” go read these too:


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


and that's a wrap bestie!! this page is from libecoli, dated 2026-06-11, and it's literally EC_COMPLETE_STRVEC(3). go complete something cute, ily πŸ¦‹πŸ’œβœ¨
πŸ“¦ where this page comes from