mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-07 17:15:26 +00:00
Shell: Add unalias builtin
Add shell unalias builtin to remove aliases
This commit is contained in:
committed by
Ali Mohammad Pur
parent
5140994c69
commit
72e661b542
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2020, the SerenityOS developers.
|
||||
* Copyright (c) 2020-2021, the SerenityOS developers.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
@@ -1362,6 +1362,19 @@ void Shell::add_entry_to_cache(const String& entry)
|
||||
cached_path.insert(index, entry);
|
||||
}
|
||||
|
||||
void Shell::remove_entry_from_cache(const String& entry)
|
||||
{
|
||||
size_t index { 0 };
|
||||
auto match = binary_search(
|
||||
cached_path.span(),
|
||||
entry,
|
||||
&index,
|
||||
[](const auto& a, const auto& b) { return strcmp(a.characters(), b.characters()); });
|
||||
|
||||
if (match)
|
||||
cached_path.remove(index);
|
||||
}
|
||||
|
||||
void Shell::highlight(Line::Editor& editor) const
|
||||
{
|
||||
auto line = editor.line();
|
||||
|
||||
Reference in New Issue
Block a user