Commit 60a8b3a8 authored by Mart Lubbers's avatar Mart Lubbers

implement environment remove <environment> for cpm

parent 99a5e610
Pipeline #20930 passed with stage
in 1 minute
......@@ -248,8 +248,15 @@ doEnvironmentAction cleanhome pwd ListEnvironments world
# (envs, world) = readIDEEnvs cleanhome EnvsFileName world
= showLines [t.target_name\\t<-envs] world
doEnvironmentAction cleanhome pwd (ImportEnvironment ef) world
= error ("Not implemented") world
doEnvironmentAction cleanhome pwd (RemoveEnvironment en) world = error ("Not implemented") world
= error "Not implemented" world
doEnvironmentAction cleanhome pwd (RemoveEnvironment en) world
# (envs, world) = readIDEEnvs cleanhome EnvsFileName world
= case span (\s->s.target_name <> en) envs of
(_, []) = error ("Environment " +++ en +++ " not found") world
(e, [_:es])
# (ok, world) = writeIDEEnvs cleanhome EnvsFileName [t\\t<-envs | t.target_name <> en] world
| not ok = error ("Error writing environmint") world
= world
doEnvironmentAction cleanhome pwd (ShowEnvironment en) world
# (envs, world) = readIDEEnvs cleanhome EnvsFileName world
# match = filter (\s->s.target_name == en) envs
......
......@@ -3,4 +3,4 @@ definition module CpmPaths
import PmEnvironment
readIDEEnvs :: !String !String !*World -> *([Target], *World)
writeIDEEnvs :: !String !String ![Target] !*World -> *(Bool, *World)
......@@ -11,3 +11,7 @@ append_dir_separator s
readIDEEnvs :: !String !String !*World -> *([Target], *World)
readIDEEnvs cleanhome ideenvs world
= openEnvironments cleanhome (append_dir_separator cleanhome+++"etc"+++DirSeparatorString+++ideenvs) world
writeIDEEnvs :: !String !String ![Target] !*World -> *(Bool, *World)
writeIDEEnvs cleanhome ideenvs envs world
= saveEnvironments (append_dir_separator cleanhome+++"etc"+++DirSeparatorString+++ideenvs) envs world
definition module CpmPaths
import PmEnvironment
readIDEEnvs :: !String !String !*World -> *([Target], *World)
implementation module CpmPaths
import StdEnv,Platform,PmEnvironment
append_dir_separator :: !{#Char} -> {#Char}
append_dir_separator s
| size s>0 && s.[size s-1]==DirSeparator
= s
= s+++DirSeparatorString
readIDEEnvs :: !String !String !*World -> *([Target], *World)
readIDEEnvs cleanhome ideenvs world
= openEnvironments cleanhome (append_dir_separator cleanhome+++"Config"+++DirSeparatorString+++ideenvs) world
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