Complete aliases in command prompt
This commit is contained in:
parent
a45876124b
commit
30ad9a0475
|
@ -16,6 +16,11 @@ public:
|
||||||
void remove_alias(const String& alias);
|
void remove_alias(const String& alias);
|
||||||
StringView operator[](const String& name) const;
|
StringView operator[](const String& name) const;
|
||||||
|
|
||||||
|
using AliasMap = UnorderedMap<String, String, MemoryDomain::Aliases>;
|
||||||
|
using iterator = AliasMap::const_iterator;
|
||||||
|
iterator begin() const { return m_aliases.begin(); }
|
||||||
|
iterator end() const { return m_aliases.end(); }
|
||||||
|
|
||||||
Vector<StringView> aliases_for(StringView command) const;
|
Vector<StringView> aliases_for(StringView command) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -567,9 +567,14 @@ Completions CommandManager::complete(const Context& context,
|
||||||
{
|
{
|
||||||
if (command.second.flags & CommandFlags::Hidden)
|
if (command.second.flags & CommandFlags::Hidden)
|
||||||
continue;
|
continue;
|
||||||
if ( prefix_match(command.first, prefix))
|
if (prefix_match(command.first, prefix))
|
||||||
result.candidates.push_back(command.first);
|
result.candidates.push_back(command.first);
|
||||||
}
|
}
|
||||||
|
for (auto& alias : context.aliases())
|
||||||
|
{
|
||||||
|
if (prefix_match(alias.first, prefix))
|
||||||
|
result.candidates.push_back(alias.first);
|
||||||
|
}
|
||||||
std::sort(result.candidates.begin(), result.candidates.end());
|
std::sort(result.candidates.begin(), result.candidates.end());
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user