| 112 | | '''complete('''''string''''')''' |
| | 112 | '''complete('''''string''''')''' looks at the list of possible classnames, functionnames and arguments (like hint() in example 2) and trys to complete the command if there's only one possibility. |
| | 113 | |
| | 114 | Note: If there's only one possible class with only one function and only one possible argument, complete() returns the whole command. |
| | 115 | |
| | 116 | * Example 2: |
| | 117 | {{{ |
| | 118 | // Existing functions: |
| | 119 | // abc, function1, function2, test, temporary |
| | 120 | |
| | 121 | CommandExecutor::complete("a"); |
| | 122 | // returns "abc" because it's the only possibility |
| | 123 | |
| | 124 | CommandExecutor::complete("fun"); |
| | 125 | // returns "function" because function1 and function2 are possible and |
| | 126 | // "function" is the common begin of both |
| | 127 | |
| | 128 | CommandExecutor::complete("t"); |
| | 129 | // returns "te" because it's the common begin of "test" and "temporary" |
| | 130 | }}} |
| | 131 | |
| | 132 | * Example 2: |
| | 133 | {{{ |
| | 134 | // Existing classes: |
| | 135 | // MyClass |
| | 136 | |
| | 137 | // Existing functions in MyClass: |
| | 138 | // myfunction |
| | 139 | |
| | 140 | // Possible arguments of MyClass::myfunction: |
| | 141 | // 10 |
| | 142 | |
| | 143 | CommandExecutor::complete("m"); |
| | 144 | // returns "MyClass myfunction 10" |
| | 145 | }}} |