         archiver.zipFolder packFile,Path.join(__dirname,".."),(err,pointer)->
             mewbot.logger.info "mewbot archive complete at #{packFile}"
             process.exit 0
+    else if Options.archiveModule.length
+        ###
+        handle archive-module argument
+        ###
+        archiver = mewbot.module("archiver")
+        packFile = mewbot.getTmpFile Options.archiveModule
+        if Options.archiveModule.indexOf(".zip") < 0
+            packFile = "#{packFile}.zip"
+        mewbot.logger.info "mewbot start archive module at #{packFile}"
+        archiver.zipFolder packFile,Path.join(__dirname,"..","mew_modules"),(err,pointer)->
+            mewbot.logger.info "mewbot archive module complete at #{packFile}"
+            process.exit 0
     else if Options.test and Options.test.length
+        ###
+        handle test argument
+        ###
         if Options.test is "all"
             Fs.readdir Path.join(__dirname,"..","testrc"),(err,files)->
                 if files and files.length

            process.exit 0
        stdin = process.openStdin()
    else if Options.build
        mew_modules_dir = Path.join __dirname,"..","mew_modules"
        Fs.readdir mew_modules_dir,(err,modules)->
            if err

checkDirectory "/mew_modules"

Switches = [
    [ "-n" , "--name name", "name of this mewbot" ],
    [ "-t" , "--test testcase", "test case to run" ],
    [ "-r" , "--role client|server", "role of this mewbot" ],
    [ "-h" , "--help", "print help information" ],
    [ "-p" , "--profile profile", "config profile of this mewbot" ],
    [ "-u" , "--update", "update mewbot" ],
    [ "-B" , "--build", "build mewbot" ],
    [ "-D" , "--debug", "debug mewbot" ],
    [ "-a" , "--adapter adapter", "set adapter of this mewbot" ],
    [ "-s" , "--service service", "add service on startup" ],
    [ "-A" , "--archive pack", "archive mewbot" ],
    [ "--archive-module pack", "archive mewbot module" ],
    [ "-m" , "--module module", "check or get module from remote server" ]
]

Options = 
    adapter           :     [] 
    test              :     process.env.MEWBOT_TEST    or ""
    role              :     process.env.MEWBOT_ROLE    or "client"
    version           :     false
    help              :     false
    update            :     false
    module            :     ""
    archive           :     ""
    archiveModule     :     ""
    name              :     process.env.MEWBOT_NAME    or "mewbot"
    services          :     []
    profile           :     process.env.MEWBOT_PROFILE or "default"
    build             :     false

Parser = new OptParse.OptionParser(Switches)
Parser.banner = "Usage mewbot [options]"
