penguin/utils

my env utils

commit 97c3596e5c5f4c8ee256aa4717387ea3e28f7760

author斟酌 鵬兄 <tgckpg@gmail.com>
date2017-12-01T10:29:55Z
subjectAdded progress display
commit 97c3596e5c5f4c8ee256aa4717387ea3e28f7760
Author: 斟酌 鵬兄 <tgckpg@gmail.com>
Date:   2017-12-01T10:29:55Z

    Added progress display
---
 python/reg-rename.py | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/python/reg-rename.py b/python/reg-rename.py
index 873f3c9..c48bfcf 100644
--- a/python/reg-rename.py
+++ b/python/reg-rename.py
@@ -8,7 +8,7 @@ parser = argparse.ArgumentParser(
 	, formatter_class = argparse.RawDescriptionHelpFormatter
 	, epilog = """
   Example:
-    %(prog)s -d ~/ -p "/(.+)_.+/" -s "\\1"
+    %(prog)s -d ~/ -p "/(.+)_.+/" -s "\\1" -t
 
   Result:
     R ".mysql_history" will be renamed to ".mysql"
@@ -114,9 +114,11 @@ class RegReplace:
 		for root, dirs, files in os.walk( path ):
 			actions = self._compile_actions( root, files )
 
-			sys.stdout.write( bb[ bb_i ] )
-			sys.stdout.flush()
-			sys.stdout.write( "\b" )
+			sys.stdout.write( "\n" )
+			sys.stdout.write( "\033[K" )
+			sys.stdout.write( "%s ... %s" % ( bb[ bb_i ], root ) )
+			sys.stdout.write("\r")
+			sys.stdout.write( "\033[F" )
 			bb_i = bb_i + 1
 			if 3 < bb_i:
 				bb_i = 0
@@ -132,7 +134,6 @@ class RegReplace:
 
 			if not self.recursive:
 				break
-		sys.stdout.write( " " )
 		sys.stdout.flush()
 
 def _compile_re( patterns ):