Commit 78fea1f2 authored by Jurrien Stutterheim's avatar Jurrien Stutterheim

s/Clopt/Cpm/g

parent 41163dd6
......@@ -20,7 +20,7 @@ import Text
import UtilIO
import UtilStrictLists
:: CloptAction
:: CpmAction
= Project FilePath ProjectAction
| Module String ModuleAction
| Help
......@@ -43,13 +43,13 @@ import UtilStrictLists
pNotSpace :: CParser Char [Char] a
pNotSpace = sp (<+> (satisfy (not o isWhite)))
pClopt :: CParser Char CloptAction a
pClopt = pProject <|> pModule <!> yield Help
pCpm :: CParser Char CpmAction a
pCpm = pProject <|> pModule <!> yield Help
spstrtok :: (String -> CParser Char [Char] a)
spstrtok = sptoken o fromString
pProject :: CParser Char CloptAction a
pProject :: CParser Char CpmAction a
pProject = spstrtok "project" &> pNotSpace <&> \pn -> pProjectAction <@ Project (toString pn)
where pProjectAction = spstrtok "create" <@ const CreateProject
<|> spstrtok "show" <@ const ShowProject
......@@ -65,7 +65,7 @@ pForce = spstrtok "--force" <@ const True <|> yield False
pIDEEnvs :: CParser Char String a
pIDEEnvs = spstrtok "--envs" &> (<?> (spsymbol '=')) &> pNotSpace <@ toString <!> yield EnvsFileName
pModule :: CParser Char CloptAction a
pModule :: CParser Char CpmAction a
pModule = spstrtok "module" &> pNotSpace <&> \mn -> pModuleAction <@ Module (toString mn)
where pModuleAction = spstrtok "create" <@ const CreateModule
<!> yield ModuleHelp
......@@ -79,17 +79,17 @@ Start world
(ch, world) = case getEnvironmentVariable "CLEAN_HOME" world of
(Just ch, world) -> (ch, world)
(_, world) -> (pwd, world)
= doCloptAction world ch pwd cpm
= doCpmAction world ch pwd cpm
startParse :: [.Char] -> CloptAction
startParse args = case filter (\(xs, _) -> xs == []) (begin pClopt args) of
startParse :: [.Char] -> CpmAction
startParse args = case filter (\(xs, _) -> xs == []) (begin pCpm args) of
[(_, as):_] -> as
_ -> Help
doCloptAction :: *World String String .CloptAction -> .World
doCloptAction world cleanhome pwd (Project pn pa) = doProjectAction world cleanhome pwd pn pa
doCloptAction world cleanhome pwd (Module mn ma) = doModuleAction world cleanhome mn ma
doCloptAction world _ _ _ =
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 <action>"
......
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