fix getenv + reuse non debug mode
This commit is contained in:
parent
2dace09a0d
commit
3cc7d380d1
2 changed files with 7 additions and 5 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue