Skip to content

Commit

Permalink
Merge branch 'release/v1.201907231125'
Browse files Browse the repository at this point in the history
  • Loading branch information
cxwithyxy committed Jul 23, 2019
2 parents cb7e7f1 + b7771f9 commit 89c0826
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 5 deletions.
7 changes: 5 additions & 2 deletions CLIS/CLISCMDBASE.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ class base(SLT.Singleton):

parser = None
name = None
help_str = ""

def __Singleton_Init__(self, parser = None):
self.parser = parser
parser.add_argument("-" + self.name)
parser.add_argument("-" + self.name, help = self.help_str)

def get_argu(self):
argu = vars(self.parser.parse_args())
Expand All @@ -20,9 +21,11 @@ def is_match(self):
return False
return True

def handle_run(self):
def handle_run(self,) -> bool:
if self.is_match():
self.run()
return True
return False

def run(self):
raise "function \"run\" mast be rewritten"
1 change: 1 addition & 0 deletions CLIS/create.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
class base(CLIS.CLISCMDBASE.base):

name = "create"
help_str = "create a project: -create your_project_name"

xlsm_download_url = "https://raw.githubusercontent.com/cxwithyxy/Excel_JS_Runtime/master/release/base.xlsm"

Expand Down
1 change: 1 addition & 0 deletions CLIS/pack.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
class base(CLIS.CLISCMDBASE.base):

name = "pack"
help_str = "pack xlsm here: -pack here"

def run(self):
argu = self.get_argu()
Expand Down
3 changes: 2 additions & 1 deletion CLIS/spread.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
class base(CLIS.CLISCMDBASE.base):

name = "spread"
help_str = "spread xlsm file and make some JS file here: -spread here"

def run(self):
argu = self.get_argu()
Expand All @@ -19,7 +20,7 @@ def run(self):

def spread_exist_xlsm(self, xlsm_path):
if not mylib.path.is_exist(xlsm_path):
print(xlsm_path + u" 文件不存在")
print(xlsm_path + " file is not exists")
exit()
proj_name = mylib.path.get_file_name_without_suffixs(xlsm_path)
create.base().make_path(proj_name)
Expand Down
1 change: 1 addition & 0 deletions CLIS/watch_pack.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
class base(CLIS.CLISCMDBASE.base):

name = "watch_pack"
help_str = "watch and wait JS file change than pack in xlsm file: -watch_pack here"
can_pack = False

def run(self):
Expand Down
10 changes: 9 additions & 1 deletion Excel_JS_Runtime_CLI.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,20 @@
import CLIS.watch_pack

parser = argparse.ArgumentParser()
parser.description = "===== Excel_JS_Runtime_CLI v1.201907231125 ====="
parser.epilog ="* MORE INFO: https://github.com/cxwithyxy/Excel_JS_Runtime_CLI"
myQueue = queue.Queue()

myQueue.put(CLIS.create.base(parser).handle_run)
myQueue.put(CLIS.spread.base(parser).handle_run)
myQueue.put(CLIS.pack.base(parser).handle_run)
myQueue.put(CLIS.watch_pack.base(parser).handle_run)

has_match_cmd = False
while not myQueue.empty():
myQueue.get()()
if(myQueue.get()()):
has_match_cmd = True
break

if(not has_match_cmd):
parser.print_help()
2 changes: 1 addition & 1 deletion mylib/path.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def mkdir(path_from_argu):
try:
pathlib.Path.mkdir(pathlib.Path(the_path))
except:
print(path_from_argu + u" 文件夹已经存在了")
print(path_from_argu + " project directory is exists")
exit()

def join_path(path_1, path_2):
Expand Down

0 comments on commit 89c0826

Please sign in to comment.