1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 17:47:44 +00:00

Shell: Add a shell option for autocompleting via the program itself

This feature needs a bit more work, so let's disable it by default.
Note that the shell will still use _complete_foo if it is defined
regardless of this setting.
This commit is contained in:
Ali Mohammad Pur 2022-03-29 16:06:20 +04:30 committed by Andreas Kling
parent cdca6fc113
commit e1cf51b0bd
2 changed files with 4 additions and 1 deletions

View file

@ -1668,6 +1668,8 @@ ErrorOr<Vector<Line::CompletionSuggestion>> Shell::complete_via_program_itself(s
auto completion_utility_name = String::formatted("_complete_{}", completion_command.argv[0]);
if (binary_search(cached_path, completion_utility_name))
completion_command.argv[0] = completion_utility_name;
else if (!options.invoke_program_for_autocomplete)
return Error::from_string_literal("Refusing to use the program itself as completion source");
completion_command.argv.extend({ "--complete", "--" });