def loadFromDir(section, command, commandsDir): result = {} if section: section = utils.lcfirst(section) if command: command = utils.lcfirst(command) for f in os.listdir(commandsDir): if f[0] == '_' or f.split('.')[-1:][0] != 'py': continue f = f.split('.')[:1][0] if f == 'Help': continue tmp = utils.caseSplit(f, firstOnly=True) _section = tmp[0] _command = tmp[1] if section and section != _section: continue if command and command != _command: continue if not result.has_key(_section): result[_section] = {} result[_section][_command] = utils.newObject( pkgName = f, className = 'Command%s' % f, path = commandsDir + '/' + f + '.py' ) return result
def loadFromDir(section, command, commandsDir): result = {} if section: section = utils.lcfirst(section) if command: command = utils.lcfirst(command) for f in os.listdir(commandsDir): if f[0] == '_' or f.split('.')[-1:][0] != 'py': continue f = f.split('.')[:1][0] if f == 'Help': continue tmp = utils.caseSplit(f, firstOnly=True) _section = tmp[0] _command = tmp[1] if section and section != _section: continue if command and command != _command: continue if not result.has_key(_section): result[_section] = {} result[_section][_command] = utils.newObject(pkgName=f, className='Command%s' % f, path=commandsDir + '/' + f + '.py') return result
def getCommands(): result = {} for dir in commands.getCommandDirs(): for file in os.listdir(dir): if file[0] == '_': continue file = file.split('.') if file[-1:][0] != 'py': continue file = '.'.join(file[:-1]) section, command = utils.caseSplit(file) if not result.has_key(section): result[section] = [] result[section].append(command) return result
def getCommands(): result = {} for dir in commands.getCommandDirs(): for file in os.listdir(dir): if file[0] == "_": continue file = file.split(".") if file[-1:][0] != "py": continue file = ".".join(file[:-1]) section, command = utils.caseSplit(file) if not result.has_key(section): result[section] = [] result[section].append(command) return result