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