Skip to content

Commit

Permalink
db selection
Browse files Browse the repository at this point in the history
  • Loading branch information
markhibberd committed Aug 12, 2012
1 parent 9d957a6 commit 8d49f6c
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions src/main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,26 @@ migratemode cwd =
, flagNone [ "d", "dry-run" ] (\a -> a { dry = True }) "do not perform any updates"
]

migrate = undefined
main =
getCurrentDirectory >>= \cwd -> processArgs (migratemode cwd) >>= run

run args
| printhelp args = mapM_ putStrLn usage
| printversion args = putStrLn $ "migrate " ++ showVersion Program.version
| otherwise = migrate
| otherwise = migrate args


bomb msg =
putStrLn msg >> exitFailure

migrate args =
case (postgres args, mysql args) of
(Nothing, Nothing) -> bomb "Must specify at exactly one of -p or -m for database selection, specified none."
(Just _, Just _) -> bomb "Must specify at exactly one of -p or -m for database selection, specified two."
(Just p, _) -> runpostgres args p
(_, Just m) -> runmysql args m


runpostgres = undefined
runmysql = undefined

main :: IO ()
main = getCurrentDirectory >>= \cwd -> processArgs (migratemode cwd) >>= run

0 comments on commit 8d49f6c

Please sign in to comment.