Nguyễn Thái Ngọc Duy <[email protected]> writes:
> Even if these are hidden options, let's make them a bit more generic
> since we're introducing more listing types shortly. The code is
> structured to allow combining multiple listing types together because
> we will soon add more types the 'builtins'.
>
> 'parseopt' remains separate because it has separate (SPC) to match
> git-completion.bash needs and will not combine with others.
> ---
Missing sign-off.
> +static int list_cmds(const char *spec)
> +{
> + while (*spec) {
> + const char *sep = strchrnul(spec, ',');
> + int len = sep - spec;
> +
> + if (len == 8 && !strncmp(spec, "builtins", 8))
> + list_builtins(0, '\n');
This is the origin of ugliness we see in later steps that follow the
same
if (len == strlen(constS) && !strncmp(spec, constS, strlen(constS))
pattern added here. Could we have a small helper that takes len,
spec, and constS to abstract "8" away?