madlang-2.4.1.5: Setup.hs
import Distribution.Simple
import System.Environment (lookupEnv)
main = writeBashCompletions >> defaultMain
-- TODO only write if we can't find our own thing!
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 ()