Skip to content

Commit

Permalink
develop : option name change cp->diffcp, adjust prefix option range
Browse files Browse the repository at this point in the history
  • Loading branch information
kunrunic committed May 15, 2021
1 parent 0b662da commit e076740
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pykun/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@


__author__ = "kunrunic ([email protected])"
__version__ = "0.1.2"
__version__ = "0.1.3"
__copyright__ = "Copyright (c) 2021 Jho Sung Jun"
__license__ = "MIT"

14 changes: 11 additions & 3 deletions pykun/file/copier.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,10 +192,18 @@ def cpFilesSrcToDest( src, dest, prefix ) :
pass
except Exception as e:
print(e)
if name.startswith(prefix) == True or prefix == False :
if name.endswith("_bk") == True :
return
def isPrefix():
if isinstance(prefix, bool) == True:
return True
return name.startswith(prefix)

if isPrefix() == True :
srcName = "{src}/{name}".format(**locals())
destName = "{dest}/{name}".format(**locals())
if diffFile(srcName, destName) == True:
os.rename(destName, "{0}_{1}_bk".format(destName, time.strftime('%Y_%m_%d_%X', time.localtime(time.time()))))
print("ok ... Copy : {srcName} -> {destName}".format(**locals()))
shutil.copy2(srcName, destName)

Expand Down Expand Up @@ -225,7 +233,7 @@ def convert(src, dest, factors):
def quickHelp():
print("Usege : copier [ option ] [ option arg ]")
print("Option :")
print("> cp - inputs [ src, dest, prefix ] ")
print("> diffcp - inputs [ src, dest, prefix ] ")
print("> cvt - inputs [src, dest, factors ] ... cvt factors input format is json")
print("> cvt factors format \'{\"DATA\":[{\"KEY\":\"CVT_MATCH_KEY\", \"VAL\":\"CVT_VAL\", \"OPT\":\"Insert Position\"}]}\' ")
print("> cvt factors option ")
Expand Down Expand Up @@ -253,7 +261,7 @@ def quickMain():
if len(sys.argv) >= 5 :
factors = sys.argv[4]
convert(src, dest, factors)
elif sys.argv[1] == "cp" :
elif sys.argv[1] == "diffcp" :
prefix = False
if len(sys.argv) >= 5 :
prefix = sys.argv[4]
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setup(name='pykun',

version='0.1.2',
version='0.1.3',

url='https://github.com/kunrunic/pykun',

Expand Down

0 comments on commit e076740

Please sign in to comment.