fix getenv + reuse non debug mode

This commit is contained in:
Yann Esposito (Yogsototh) 2017-03-04 21:11:29 +01:00
parent 2dace09a0d
commit 3cc7d380d1
Signed by untrusted user who does not match committer: yogsototh
GPG key ID: 7B19A4C650D59646
2 changed files with 7 additions and 5 deletions

View file

@ -12,7 +12,7 @@ import Pipes
import Prelude (String, lines)
import Protolude hiding (for, many, show, (<|>))
import System.Console.Haskeline
-- import System.Environment (getEnvironment)
import System.Environment (getEnvironment)
import Text.Parsec (ParseError)
import Lish.Eval
@ -22,9 +22,8 @@ import Lish.Types
-- | Start an interactive lish shell
runLish :: IO ()
runLish = do
-- env <- toEnv <$> getEnvironment
-- runInputT defaultSettings (mainLoop env)
runInputT defaultSettings (mainLoop (toEnv []))
env <- toEnv <$> getEnvironment
runInputT defaultSettings (mainLoop env)
-- | System Environment -> LISH Env
toEnv :: [(String,String)] -> Env

View file

@ -63,7 +63,10 @@ getenv :: ReduceUnawareCommand
getenv ((Atom varname):[]) = do
hm <- get
return $ fromMaybe Void (Map.lookup varname hm)
getenv _ = evalErr "getenv need on atom as argument"
getenv ((Str varname):[]) = do
hm <- get
return $ fromMaybe Void (Map.lookup varname hm)
getenv _ = evalErr "getenv need on atom or a string as argument"
-- | replace à la `sed s/old/new/g text`
replace :: ReduceUnawareCommand