Ejemplo n.º 1
0
void Shell::executeCommand(const LineBuffer& line){
  _out << '\n';
  _modules.commandExecute(line.line(), *this);
  const auto executionResult = handleExecuteCommand(line);
  _modules.commandExecuted(executionResult, line.line(), *this);
  switch (executionResult.status()) {
    case Status::NoMatch:
      _out << "Command not found [" << line.firstWord() << "]\n";
    case Status::Ok:
      prompt();
      break;
    case Status::Incomplete:
      _function.parse(":prompt_feed", _out, true);
      _column = _cursor.position().x;
      break;
  }
}
Ejemplo n.º 2
0
ParseResult Shell::handleExecuteCommand(const LineBuffer& line){
  _buffer += line.line();

  const ParseResult executionResult {
    _commands.parse(_buffer, _out, true)};

  switch (executionResult.status()) {
    case Status::Incomplete:
      _buffer += '\n';
      break;
    default:
      _buffer.clear();
      break;
  }
  return executionResult;
}
Ejemplo n.º 3
0
void Shell::displayLine(const LineBuffer& line){
  _cursor.column(_column);
  auto matched = _commands.parse(line.line(), _out, false);
  _modules.lineUpdated(matched, line, *this);
  _cursor.column(line.pos() + _column);
}