Commit e4003527 authored by Jurrien Stutterheim's avatar Jurrien Stutterheim

CPM: More natural help message behaviour

parent 76d6e1e9
......@@ -56,12 +56,13 @@ spstrtok :: (String -> CParser Char [Char] a)
spstrtok = sptoken o fromString
pProject :: CParser Char CpmAction a
pProject = spstrtok "project" &> pNotSpace <&> \pn -> pProjectAction <@ Project (toString pn)
where pProjectAction = (spstrtok "create" <@ const CreateProject)
<|> (spstrtok "show" <@ const ShowProject)
<|> (spstrtok "build" &> pForce <&> \ f-> pIDEEnvs <@ BuildProject f)
<|> (spstrtok "path" &> pPathAction)
<!> (pHelp ProjectHelp)
pProject = spstrtok "project" &> (pProjectWithName <|> yield (Project "" ProjectHelp))
where pProjectWithName = pNotSpace <&> \pn -> pProjectAction <@ Project (toString pn)
pProjectAction = (spstrtok "create" <@ const CreateProject)
<|> (spstrtok "show" <@ const ShowProject)
<|> (spstrtok "build" &> pForce <&> \ f-> pIDEEnvs <@ BuildProject f)
<|> (spstrtok "path" &> pPathAction)
<!> (pHelp ProjectHelp)
pPathAction :: CParser Char ProjectAction a
pPathAction = pPathAction <@ ProjectPath
......@@ -78,11 +79,12 @@ pIDEEnvs = (spstrtok "--envs" &> (<?> (spsymbol '=')) &> pNotSpace <@ toString)
<!> (yield EnvsFileName)
pModule :: CParser Char CpmAction a
pModule = spstrtok "module" &> pNotSpace <&> \mn -> pModuleAction <@ Module (toString mn)
where pModuleAction = (spstrtok "create" &> pModuleType <@ CreateModule)
<!> (pHelp ModuleHelp)
pModuleType = (spstrtok "application" <@ const ApplicationModule)
<|> (yield LibraryModule)
pModule = spstrtok "module" &> (pModuleWithName <|> yield (Module "" ModuleHelp))
where pModuleWithName = pNotSpace <&> \mn -> pModuleAction <@ Module (toString mn)
pModuleAction = (spstrtok "create" &> pModuleType <@ CreateModule)
<!> (pHelp ModuleHelp)
pModuleType = (spstrtok "application" <@ const ApplicationModule)
<|> (yield LibraryModule)
pHelp :: c -> CParser Char c a
pHelp c = (spstrtok "help" <@ const c) <|> (yield c)
......
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