Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Aug 28, 2010, 12:37:38 AM (15 years ago)
Author:
landauf
Message:

the unhide command now also supports auto-completion for the hidden commands

File:
1 edited

Legend:

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

    r7233 r7234  
    123123        }
    124124
    125         ARGUMENT_COMPLETION_FUNCTION_IMPLEMENTATION(hiddengroupsandcommands)()
    126         {
    127             return detail::_groupsandcommands(true);
    128         }
    129 
    130         ARGUMENT_COMPLETION_FUNCTION_IMPLEMENTATION(hiddensubcommands)(const std::string& fragment, const std::string& group)
    131         {
    132             return detail::_subcommands(fragment, group, true);
    133         }
    134 
    135125        ARGUMENT_COMPLETION_FUNCTION_IMPLEMENTATION_MULTI(command)(const std::string& fragment)
    136126        {
     
    148138                return list;
    149139            }
     140        }
     141
     142        ARGUMENT_COMPLETION_FUNCTION_IMPLEMENTATION_MULTI(hiddencommand)(const std::string& fragment)
     143        {
     144            SubString tokens(fragment, " ", SubString::WhiteSpaces, false, '\\', true, '"', true, '(', ')', true, '\0');
     145
     146            if (tokens.size() == 0)
     147                return detail::_groupsandcommands(true);
     148
     149            if (_ConsoleCommand::getCommandLC(getLowercase(tokens[0])))
     150                return ARGUMENT_COMPLETION_FUNCTION_CALL(command)(fragment);
     151
     152            if (tokens.size() == 1)
     153            {
     154                std::map<std::string, std::map<std::string, _ConsoleCommand*> >::const_iterator it_group = _ConsoleCommand::getCommands().find(tokens[0]);
     155                if (it_group != _ConsoleCommand::getCommands().end())
     156                    return detail::_subcommands(fragment, tokens[0], true);
     157                else
     158                    return detail::_groupsandcommands(true);
     159            }
     160
     161            if (_ConsoleCommand::getCommandLC(getLowercase(tokens[0]), getLowercase(tokens[1])))
     162                return ARGUMENT_COMPLETION_FUNCTION_CALL(command)(fragment);
     163
     164            return ArgumentCompletionList();
    150165        }
    151166
Note: See TracChangeset for help on using the changeset viewer.