Source

csound-package-manager / cspm.py

Full commit
#!/usr/bin/env python

VERSION = "1.0 Alpha"


class Command(object):
    def __init__(self, commandName, description, processFunction):
        self.commandName = commandName
        self.description = description
        self.processFunction = processFunction
    
    def process(self, args):
        """Function for Command to do work"""
        return self.processFunction(args)
    
def dummyFunc(args):
    print "Command not implemented"
    return True
    
commands = [Command("install", "Installs a list of packages.", dummyFunc ),
            Command("update", "Update list of known packages.", dummyFunc),
            Command("list", "List packages matching a search string.", dummyFunc),
            Command("info", "Display detailed information about a particular package.", dummyFunc),
            Command("init", "Create a default .cspm file in the current directory.", dummyFunc)

             ]    


def usage():
    message = """Csound Package Manager - version %s
    
Usage: cspm.py COMMAND [flags]
       
Commands:
"""%VERSION

    for i in commands:
        message += "  %-14s%s\n"%(i.commandName, i.description)
        
    return message

    
if __name__ == '__main__':
    print usage()