bool
StatesType::List( CommandInterpreter& inInterpreter )
{
  Lock lock( inInterpreter.StateMachine() );
  string pattern = inInterpreter.GetRemainingTokens();
  if( pattern.empty() )
    pattern = "*";
  const StateList& states = inInterpreter.StateMachine().States();
  for( int i = 0; i < states.Size(); ++i )
    if( WildcardMatch( pattern, states[i].Name(), false ) )
      inInterpreter.Out() << states[i] << '\n';
  return true;
}
bool
DirectoryType::List( CommandInterpreter& inInterpreter )
{
  string args;
#if _WIN32
  args = "/n ";
#else
  args = "-l ";
#endif
  string remainder = inInterpreter.GetRemainingTokens();
  args += remainder;
  inInterpreter.Out() << ListDirectory( args );
  return true;
}
Esempio n. 3
0
bool
LineType::Write( CommandInterpreter& inInterpreter )
{
  string args = inInterpreter.GetRemainingTokens(),
         line;
  istringstream iss( args );
  ParserToken arg;
  if( iss >> arg )
    line = arg;
  while( iss >> arg )
  {
    line += " ";
    line += arg;
  }
  if( !inInterpreter.WriteLine( line ) )
    throw bciexception( "No output associated with command interpreter of type " << ClassName( typeid( inInterpreter ) ) );
  return true;
}