From e7a889a4c1150d9dc50b75e989d8082d909f2eba Mon Sep 17 00:00:00 2001 From: Mart Lubbers Date: Mon, 3 Jun 2019 12:51:36 +0200 Subject: [PATCH] support template exporting in cpm --- cpm/AbsSyn.dcl | 1 + cpm/CpmLogic.icl | 8 ++++++++ cpm/Parser.icl | 1 + 3 files changed, 10 insertions(+) diff --git a/cpm/AbsSyn.dcl b/cpm/AbsSyn.dcl index c838142..ac518ee 100644 --- a/cpm/AbsSyn.dcl +++ b/cpm/AbsSyn.dcl @@ -25,6 +25,7 @@ from StdMaybe import :: Maybe | SetExec String | SetBytecode (Maybe String) | SetProjectOptions [ProjectOption] + | ExportTemplate FilePath | ProjectHelp :: PathAction diff --git a/cpm/CpmLogic.icl b/cpm/CpmLogic.icl index 92fdf02..183c9fe 100644 --- a/cpm/CpmLogic.icl +++ b/cpm/CpmLogic.icl @@ -170,6 +170,13 @@ where doProjectAction cleanhome pwd pn (SetBytecode (Just bcfile)) world = withProject pwd pn cleanhome (PR_SetByteCodePath bcfile) world +doProjectAction cleanhome pwd pn (ExportTemplate prt) world + # (project_path, project, ok, world) = openProject pwd pn cleanhome world + | not ok = error "Error opening project" world + # (ok, world) = accFiles (save_project_template_file prt project cleanhome) world + | not ok = error "Error saving project template" world + = world + doProjectAction cleanhome pwd pn (SetProjectOptions project_options) world = withProject pwd pn cleanhome (set_project_options project_options) world where @@ -242,6 +249,7 @@ doProjectAction _ _ _ _ world = , " target : set target environment to " , " exec : set executable name to " , " bytecode [bc] : set bytecode file to or .bc if no file given" + , " template : export the given project to a template file" , " set