#!/usr/bin/env python2 """ A Script to dump the commands out from cometCommands into a text file for documentaiton. """ import cometCommands import sys import re try: commandFile = open("cometcontrolOptions.list","w") commandList = cometCommands.cometCommands() for section in commandList.sections: for char in section: commandFile.write("=") commandFile.write("==\n") commandFile.write(section+" :\n") for char in section: commandFile.write("=") commandFile.write("==\n") commandFile.write(commandList.getSectionHelp(section)+"\n\n") commandFile.write("Available Commands:\n\n") if section == "user_modules": for command in commandList.help.options(section): if not re.compile(r'_\d$').search(command): commandFile.write(command+" : "+commandList.getCommandHelp(section,command)+"\n\n") else: for command in commandList.help.options(section): commandFile.write(command+" : "+commandList.getCommandHelp(section,command)+"\n\n") except: sys.exit("Could not dump command help to cometcontrolOptions.list")