diff --git a/tren.py b/tren.py index 19cd970..fdfbfe1 100755 --- a/tren.py +++ b/tren.py @@ -7,7 +7,7 @@ PROGNAME = "tren.py" PROGENV = PROGNAME.split(".py")[0].upper() -RCSID = "$Id: tren.py,v 1.120 2010/01/29 18:52:29 tundra Exp $" +RCSID = "$Id: tren.py,v 1.121 2010/01/29 21:07:17 tundra Exp $" VERSION = RCSID.split()[2] # Copyright Information @@ -66,7 +66,7 @@ MAXLINELEN = 75 # Maximum length of printed line PADCHAR = " " # Padding character PADWIDTH = 30 # Column width -SEQPAD = 13 # Padding to use when dumping sequence tables +LSTPAD = 13 # Padding to use when dumping lists WRAPINDENT = 8 # Extra indent on wrapped lines @@ -101,19 +101,20 @@ dINCLUDING = "Including file '%s'" dPAIR = "Option/Target Pair" dPROGENV = "$" + PROGENV +dRENREQ = "Renaming Requests:" dRESOLVEDOPTS = "Resolved Command Line" dSEQATIME = "Access Time Sequence:" dSEQCMD = "Command Line Sequence:" dSEQCTIME = "Creation Time Sequence:" dSEQDEV = "Device Sequence:" -dSEQGID = "GID Sequence" +dSEQGID = "GID Sequence:" dSEQINO = "Inode Sequence:" dSEQMODE = "Mode Sequence:" dSEQMTIME = "Modification Time Sequence:" dSEQNLINK = "Nlinks Sequence" dSEQSIZE = "Size Sequence:" dSEQTARGS = "Rename Targets:" -dSEQUID = "UID Seqeuence" +dSEQUID = "UID Sequence:" ##### @@ -328,11 +329,9 @@ if DEBUG: - - DebugMsg(debugmsg) + l=[] for item in vieworder: - itemarrow = ColumnPad([item, ARROW], padwidth=SEQPAD) - DebugMsg(ColumnPad([" ", " %s %s" % (itemarrow, view[item])])) + DumpList(DebugMsg, debugmsg, item, view[item]) if DEBUG: DumpRenameObj(self) @@ -403,6 +402,19 @@ ##### +# Debug Dump Of A List +##### + +def DumpList(handler, msg, listname, content): + + handler(msg) + itemarrow = ColumnPad([listname, ARROW], padwidth=LSTPAD) + handler(ColumnPad([" ", " %s %s" % (itemarrow, content)])) + +# End of 'DumpList()' + + +##### # Dump The Contents Of A Rename Object ##### @@ -590,6 +602,17 @@ ##### +# Process Command Line Renaming Requests +##### + +def ProcessRenReq(val): + + return val.split("=") + +# End of 'ProcessRenReq()' + + +##### # Print Usage Information ##### @@ -669,6 +692,8 @@ for commandline in pairs: + RenRequests = [] + if DEBUG: DebugMsg(ColumnPad([dPAIR, " ".join(commandline)])) @@ -678,9 +703,10 @@ ErrorMsg(eBADARG % e.args[0]) sys.exit(1) - # Create and populate an object with rename targets. - # We have to do this here so that subsequent - # renaming tokens references can be resolved. + # Create and populate an object with rename targets. We have to + # do *before* we process any renaming requests because they may make + # reference to renaming tokens that only can be resolved with the + # contents of the 'targs' data structure. targs = None if args: @@ -718,7 +744,7 @@ if opt == "-q": QUIET = True if opt == "-r": - pass + RenRequests.append(ProcessRenReq(val)) if opt == "-t": TESTMODE = True if opt == "-v": @@ -730,6 +756,11 @@ REGEX = True + # Display outstanding renaming requests if we're debugging + + if DEBUG: + DumpList(DebugMsg, dRENREQ , "", RenRequests) + # Release the target container if we created one if targs: del targs