module Text.Madlibs.Exec.Helpers (writeBashCompletions) where

import           System.Environment (lookupEnv)

-- TODO something less stupid with error messages
writeBashCompletions :: IO ()
writeBashCompletions = do
    home <- lookupEnv "HOME"
    case home of
        Just x -> appendFile (x ++ "/.bashrc") "\n# Added by madlang\neval \"$(madlang --bash-completion-script madlang)\"\n"
        Nothing -> pure ()