adding verbosity..

This commit is contained in:
q
2016-10-30 12:33:10 +02:00
parent 2c7b94acce
commit 4219c41ff3
4 changed files with 15 additions and 10 deletions

View File

@@ -1,4 +1,5 @@
#!/usr/bin/python
# coding=UTF-8
import sys
import os,time,datetime
import sqlite3
@@ -115,7 +116,7 @@ def start_sync(options):
(SRC,TGT)=sync
if not SRC:
return
print("Starting: #%d %s -> %s"%(i+1,SRC,TGT))
print("Starting: #%d %s ─▶ %s"%(i+1,SRC,TGT))
syncopts=shlex.split(options.options)
command=['rsync']
command.extend(syncopts)
@@ -129,7 +130,7 @@ def start_sync(options):
if '\n' in line:
j+=1
if j%50==0:
line=line.replace("\n","\n#%d %s -> %s\n"%(i+1,SRC,TGT),1)
line=line.replace("\n","\n#%d/%d %s ─▶ %s\n"%(i+1,len(sync_list),SRC,TGT),1)
j=1
sys.stdout.write(line)
sys.stdout.flush()
@@ -142,8 +143,8 @@ def start_sync(options):
lines_iterator = iter(popen.stderr.readline, b"")
for line in lines_iterator:
sys.stdout.write(line)
print("FAILED: EC: %d, %s -> %s"%(popen.returncode,SRC,TGT))
print("Finished: #%d %s -> %s"%(i+1,SRC,TGT))
print("FAILED: EC: %d, %s ─▶ %s"%(popen.returncode,SRC,TGT))
print("Finished: #%d %s ─▶ %s"%(i+1,SRC,TGT))
def main():
options=setup_options();
@@ -151,7 +152,7 @@ def main():
if not os.path.exists(options.sqlfile):
createdb(options.sqlfile);
if options.SRC!='' and options.TGT!='':
print("Adding: %s -> %s"%(options.SRC,options.TGT))
print("Adding: %s ─▶ %s"%(options.SRC,options.TGT))
add(options)
if options.clear:
print("Clearing database")

View File

@@ -98,3 +98,6 @@ class code:
return self.custom_match.sub('\033[\\2',s)
def custom_nocolor(self,s):
return self.custom_match.sub('',s)
def get_keys(self):
return self.color_keys

View File

@@ -11,14 +11,15 @@ __version__ = "0.2"
''' Rules modified from mistune project '''
def setup_options():
bc=ansi.code()
''' Create command line options '''
usage='''
Markdown syntax color in ansi codes.
Special syntaxes:
* Colors: insert string ${C}, where C is one of KRGBYMCWkrgbymcwSUZ
* Any ANSI control code: ${3A}, ${1;34;42m}, etc..
Colors: insert string ${C}, where C is one of %s.
Any ANSI control code: ${3A}, ${1;34;42m}, etc..
'''
'''%(" ".join(bc.get_keys()))
parser=ArgumentParser(description=usage,
epilog=__author__)

View File

@@ -32,9 +32,9 @@ def setup_options():
usage='''
Color notation renderer in ANSI codes
Special syntaxes:
* Colors: insert string ${C}, where C is one of KRGBYMCWkrgbymcwSUZ
* Colors: insert string ${X}, where X is one of %s.
'''
'''%(" ".join(bc.get_keys()))
parser=ArgumentParser(description=usage,
formatter_class=argparse.RawDescriptionHelpFormatter,