Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Aug 28, 2010, 4:48:48 PM (15 years ago)
Author:
landauf
Message:

added a function to compute the Levenshtein distance between two strings to StringUtils.
used this in CommandEvaluation to correct misspelled commands (not automatically though, just to print a suggestion to the user)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/consolecommands3/src/libraries/core/command/TclBind.cc

    r7236 r7238  
    135135
    136136        int error;
    137         const std::string& result = CommandExecutor::query(command, &error, false);
     137        CommandEvaluation evaluation = CommandExecutor::evaluate(command);
     138        const std::string& result = evaluation.query(&error);
    138139        switch (error)
    139140        {
     
    143144            case CommandExecutor::Denied:      COUT(1) << "Error: Can't execute command \"" << command << "\", access denied. (B)" << std::endl; break;
    144145        }
     146
     147        if (error == CommandExecutor::Error)
     148            COUT(3) << "Did you mean \"" << evaluation.getCommandSuggestion() << "\"?" << std::endl;
    145149
    146150        return result;
Note: See TracChangeset for help on using the changeset viewer.