initialization = require './initialization'
initserver = require './tools/initServer'
initschema = require './tools/initSchema'
remoteRun = require './tools/remoteRun'
startBydevelopment = require './tools/startBydevelopment'
sync = require './tools/syncToServer'
version = require './tools/version'
help = require './help'

module.exports = (argv) ->
    parameter = argv[2]
    switch parameter
        when 'init' then init()
        when 'initserver' then initserver(argv)
        when 'initschema' then initschema()
        when 'start' then startBydevelopment()
        when 'sync' then sync(argv)
        when '--version' then showVersion()
        when '-v' then showVersion()
        when 'remote' then remoteRun()
        else showHelp()

init = () ->
    initialization()

showHelp = () ->
    help.show('default')

showVersion = () ->
    console.log version()
    process.exit()
