def main(argv=None):

    argv = sys.argv

    path = os.path.abspath(os.path.dirname(__file__))

    if len(argv) == 1 or argv[1] == "--help" or argv[1] == "-h":
        print(globals()["__doc__"])

        map_keyword2script = mapKeyword2Script(path)

        if 2 <= len(argv):

            print('CGAT tools are grouped by keywords. The following keywords')
            print('are defined:\n')
            print("%s\n" % printListInColumns(map_keyword2script.keys(),
                                              3))

        if 'all' in argv[2:]:
            print("The list of all available commands is:\n")
            print("%s\n" % printListInColumns(
                sorted([os.path.basename(x)[:-3]
                        for x in glob.glob(os.path.join(path, "*.py"))]),
                3))

        else:
            for arg in argv[2:]:
                if arg in map_keyword2script:
                    print ("Tools matching the keyword '%s':\n" % arg)
                    print ('%s\n' % printListInColumns(
                        sorted(map_keyword2script[arg]),
                        3))
        return

    command = argv[1]

    (file, pathname, description) = imp.find_module(command, [path, ])
    module = imp.load_module(command, file, pathname, description)
    # remove 'cgat' from sys.argv
    del sys.argv[0]
    module.main(sys.argv)
dataset/ETHPy150Open CGATOxford/cgat/scripts/cgat.py/main/swapped operands of `<=`