diff --git a/src/Lish/Core.hs b/src/Lish/Core.hs index 6bbc60c..b9edff8 100644 --- a/src/Lish/Core.hs +++ b/src/Lish/Core.hs @@ -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 diff --git a/src/Lish/InternalCommands.hs b/src/Lish/InternalCommands.hs index 9a04293..828f329 100644 --- a/src/Lish/InternalCommands.hs +++ b/src/Lish/InternalCommands.hs @@ -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