1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 18:37:35 +00:00

Shell: Initial support for 'option' completions

Take one small step towards #2357.
Handle completing barewords starting with '-' by piping the requests to
the Shell::complete_option(program_name, option) :^)

Also implements completion for a single builtin (setopt) until we figure out how
to handle #2357.
This commit is contained in:
AnotherTest 2020-06-29 06:26:06 +04:30 committed by Andreas Kling
parent b8d1edb2a2
commit ff857cd358
5 changed files with 162 additions and 31 deletions

View file

@ -776,3 +776,16 @@ bool Shell::run_builtin(int argc, const char** argv, int& retval)
return false;
}
bool Shell::has_builtin(const StringView& name) const
{
#define __ENUMERATE_SHELL_BUILTIN(builtin) \
if (name == #builtin) { \
return true; \
}
ENUMERATE_SHELL_BUILTINS();
#undef __ENUMERATE_SHELL_BUILTIN
return false;
}