main :: IO()
main = getArgs >>= \case []  -> shelly $ defaultScript
                         [s] -> shelly $ (thisScript . fromText . T.pack) s
    where defaultScript = do
                preflight schema_init_path >>= \case [] -> return ()
                                                     es -> echo (T.unlines es) >> quietExit 1
                run_ psql_path ["-U", "broscore", "-f", toTextIgnore schema_init_path]
          thisScript s = do
                preflight s >>= \case [] -> return ()
                                      es -> echo (T.unlines es) >> quietExit 1
                run_ psql_path ["-U", "broscore", "-f", toTextIgnore s]
main :: IO()
main = getArgs >>= \case []  -> shelly $ defaultScript
                         [s] -> shelly $ (thisScript . fromText . T.pack) s
    where defaultScript = do
                preflight schema_init_path >>= \case [] -> return ()
                                                     es -> echo (T.unlines es) >> quietExit 1
                run_ psql_path ["-U", "broscore", "-f", toTextIgnore schema_init_path]
          thisScript s = do
                preflight s >>= \case [] -> return ()
                                      es -> echo (T.unlines es) >> quietExit 1
                run_ psql_path ["-U", "broscore", "-f", toTextIgnore s]
main = getArgs >>= \case []  -> shelly $ defaultScript
                         [s] -> shelly $ (thisScript . fromText . T.pack) s
    where defaultScript = do
                preflight schema_init_path >>= \case [] -> return ()
                                                     es -> echo (T.unlines es) >> quietExit 1
                run_ psql_path ["-U", "broscore", "-f", toTextIgnore schema_init_path]
          thisScript s = do
                preflight s >>= \case [] -> return ()
                                      es -> echo (T.unlines es) >> quietExit 1
                run_ psql_path ["-U", "broscore", "-f", toTextIgnore s]