docs: def _doCommandCompletion(self):
          """ Command-completion method """        
          prefix =  ''.join(self.inputBuffer).strip().upper()
          matches = self.completion.keys(prefix)
          matchLen = len(matches)        
          if matchLen == 0 and prefix[-1] == '=':
              try:                
                  command = prefix[:-1]
              except KeyError:
                  pass                        
              else:
                  self.__printCommandSyntax(command)
          elif matchLen > 0:                        
              if matchLen == 1:
                  if matches[0] == prefix:
                      # User has already entered command - show command syntax
                      self.__printCommandSyntax(prefix)
                  else:
                      # Complete only possible command
                      self.inputBuffer = list(matches[0])
                      self.cursorPos = len(self.inputBuffer)
                      self._refreshInputPrompt(len(self.inputBuffer))
                  return
              else:
                  commonPrefix = self.completion.longestCommonPrefix(''.join(self.inputBuffer))
                  self.inputBuffer = list(commonPrefix)
                  self.cursorPos = len(self.inputBuffer)
                  if matchLen > 20:
                      matches = matches[:20]
                      matches.append('... ({0} more)'.format(matchLen - 20))
              sys.stdout.write('\n')
              for match in matches:
                  sys.stdout.write(' {0} '.format(match))
              sys.stdout.write('\n')
              sys.stdout.flush()
              self._refreshInputPrompt(len(self.inputBuffer))