def commands(data): # Process the user command args = getArgs(data) contFlag = get("continued") if(contFlag == 1): routes[get("prevCmd")](args, contFlag, data) elif args[0] in routes: routes[args[0]](args, contFlag, data) else: error("Error: Command Unavaliable")
def insertBlock(args,flag, data): if(flag == 1): log("Creating Block \"" + get("key") + "\"") save("blocks/"+get("key"),data) set("continued",0) printBlue("Block Creation Complete.") else: set("continued",1) set("prevCmd", "create") set("key",args[1]) log("Enter Block Information and press Ctrl+D when done!")
def insertFile(args,flag,data): # PARAM_CONSTRUCT = 2 PARAM_KEY = 1 PARAM_BLOCKS_BASE = 2 data = [] files = os.listdir("blocks") for x in args[PARAM_BLOCKS_BASE:]: if("unset" not in get("tag")): # Tagging system works! x = get("tag") + "." + x if x in files: data.append(x) else : print "Error: Invalid Block" save("files/" + args[PARAM_KEY], json.dumps(data))
def main(): init() while 1: if(get("continued") == 0): try: line = sys.stdin.readline() except KeyboardInterrupt: break if not line: break commands(line) # Allow the copying of all information to the commands line else: try: line = sys.stdin.read() except KeyboardInterrupt: break if not line: break commands(line)
def start(args,flag): nargs = get("nargs") if( nargs > 1): mkdir(args[1])