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

Refactor CPM help messages

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