Commit 00e0e40d authored by Jurrien Stutterheim's avatar Jurrien Stutterheim

Refactor CPM help messages

parent 898fabe4
......@@ -90,14 +90,11 @@ doCpmAction :: *World String String .CpmAction -> .World
doCpmAction world cleanhome pwd (Project pn pa) = doProjectAction world cleanhome pwd pn pa
doCpmAction world cleanhome pwd (Module mn ma) = doModuleAction world cleanhome mn ma
doCpmAction world _ _ _ =
help [ "CPM: Clean Project Management"
, ""
, "Usage: cpm <target>"
, "Where <target> is one of the following:"
, " project : project actions"
, " module : module action"
, ""
, "Execute `cpm <target> help` to get help for specific actions."] world
help "cpm <target>" [ "Where <target> is one of the following:"
, " project : project actions"
, " module : module action"
, ""
, "Execute `cpm <target> help` to get help for specific actions."] world
doProjectAction :: *World .String .String .String .ProjectAction -> .World
doProjectAction world cleanhome pwd pn CreateProject
......@@ -144,12 +141,12 @@ doProjectAction world cleanhome pwd pn (BuildProject force ideenvs)
= gst_world
doProjectAction world cleanhome _ pn (ProjectPath pa) = doProjectPathAction world cleanhome pn pa
doProjectAction world _ _ _ _ =
help [ "create : create a new project"
, "show : show project information"
, "build [--force] : build the project. Optionally force build (default: 'false')"
, "path <add|remove> : add or remove a path from the project"
, "help : show this help message"] world
doProjectAction world _ _ _ _ =
help "cpm project <projectname.prj> <action>" [ "Where <action> is one of the following"
, " create : create a new project"
, " show : show project information"
, " build [--force] : build the project. Optionally force build (default: 'false')"
, " path <add|remove> : add or remove a path from the project"] world
doProjectPathAction :: *World .String .String .PathAction -> .World
doProjectPathAction world cleanhome pn (AddPathAction path)
......@@ -160,7 +157,7 @@ doProjectPathAction world cleanhome pn (AddPathAction path)
Error e = error e world
Ok project
# paths = StrictListToList (PR_GetPaths project)
= help ["Paths" +++ toString (length paths)] world
= show ["Paths" +++ toString (length paths)] world
doProjectPathAction world cleanhome pn (RemovePathAction path) = undef
......@@ -182,8 +179,8 @@ doModuleAction world cleanhome mn CreateModule
= undef
doModuleAction world _ _ _ =
help [ "create [application|library] : create a new module. Optionally specify module type (default: 'library')"
, "help : show this help message"] world
help "cpm module <action>" [ "Where <action> is one of the following"
, " create [application|library] : create a new module. Optionally specify module type (default: 'library')"] world
error :: {#.Char} *World -> .World
error message world
......@@ -192,15 +189,20 @@ error message world
# world = set_return_code_world (-1) world
= world
help :: ![String] !*World -> *World
help lines world
help :: !String ![String] !*World -> *World
help cmd lines world = show lines` world
where lines` = [ "CPM: Clean Project Management"
: ""
: "Usage: " +++ cmd
: lines]
show :: ![String] !*World -> *World
show lines world
# (console,world) = stdio world
# console = seqSt (\s c -> fwrites (s +++ "\n") c) lines console
# (_,world) = fclose console world
= world
show :: ![String] !*World -> *World
show ls w = help ls w
// TODO: Use the version from BatchBuild
pinit :: .Bool *GeneralSt -> *GeneralSt
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment