Small code cleanup in command_manager.cc

This commit is contained in:
Maxime Coste 2015-08-27 13:57:56 +01:00
parent 04536657d1
commit b529288176

View File

@ -550,20 +550,14 @@ Completions CommandManager::complete(const Context& context,
switch (token_type) switch (token_type)
{ {
case Token::Type::OptionExpand: case Token::Type::OptionExpand:
{ return {start , cursor_pos,
Completions result(start , cursor_pos); GlobalScope::instance().option_registry().complete_option_name(
result.candidates = GlobalScope::instance().option_registry().complete_option_name( tokens[tok_idx].content(), cursor_pos_in_token) };
tokens[tok_idx].content(), cursor_pos_in_token);
return result;
}
case Token::Type::ShellExpand: case Token::Type::ShellExpand:
{ return offset_pos(shell_complete(context, flags, tokens[tok_idx].content(),
Completions shell_completions = shell_complete( cursor_pos_in_token), start);
context, flags, tokens[tok_idx].content(), cursor_pos_in_token);
shell_completions.start += start;
shell_completions.end += start;
return shell_completions;
}
case Token::Type::Raw: case Token::Type::Raw:
{ {
if (tokens[cmd_idx].type() != Token::Type::Raw) if (tokens[cmd_idx].type() != Token::Type::Raw)