from __future__ import absolute_import
from tornado import options
from . import commands
import logging
import sys

VALID_ARGS = ('init', 'compile', 'serve')

def create_options():
    "Add options to tornado"

    options.define('name', default='Default site', group='Init options',
        help='Site name and title')
    options.define('site_class', default='statirator.site.Html5Site',
            group='Init options', help='The base class for the site')
    options.define('source', default='source', group='Init options',
        help="Site's source directory")
    options.define('build', default='build', group='Init options',
        help="Site's build directory")

def main():
    create_options()
    args = options.parse_command_line()

    if not args or args[0] not in VALID_ARGS:
        valid_opts = ', '.join(VALID_ARGS)
        logging.error('Invalid option. Valid options are {0}'.format(valid_opts))
        options.print_help()
        sys.exit(1)

    cmd = getattr(commands, args[0])
    cmd(args, options)


if __name__ == '__main__':
    main()

@@ -1,118 +1,41 @@
-from __future__ import absolute_import%0Afrom tornado import options%0Afrom . import commands%0Aimport logging%0Aimport sy
+import argparse%0Afrom . import command
 s%0A%0AV
@@ -131,82 +131,298 @@
 do%22%0A
+    
 %0A    
-options.define('name', default='Default site', 
+parser = argparse.ArgumentParser(%0A            'Staitrator - Static multilingual site and blog generator')%0A%0A    parser.add_argument('command', choices=VALID_ARGS)%0A    init = parser.add_argument_
 group
-=
+(
 'Init 
-o
+O
 ptions'
-,%0A
+)%0A    init.add_argument('-n', '--name', default='Default site',%0A    
     
@@ -457,32 +457,43 @@
 e')%0A    
-options.define('
+init.add_argument('-c', '--
 site_cla
@@ -545,38 +545,16 @@
         
- group='Init options',
  help='T
@@ -590,187 +590,149 @@
     
-options.define('source', default='source', group='Init options',%0A        help=%22Site's source directory%22)%0A    options.define('build', default='build', group='Init options',%0A       
+init.add_argument('-s', '--source', default='source', help=%22Site's source directory%22)%0A    init.add_argument('-b', '--build', default='build',
  hel
@@ -764,300 +764,98 @@
 %22)%0A%0A
-def main():%0A
     
-c
 re
-ate_options()%0A    args = options.parse_command_line()%0A%0A    if not args or args%5B0%5D not in VALID_ARGS:%0A        valid_opts = ', '.join(VALID_ARGS)%0A        logging.error('Invalid option. Valid options are %7B0%7D'.format(valid_opts))%0A        options.print_help()%0A        sys.exit(1
+turn parser%0A%0Adef main():%0A    parser = create_options()%0A    args = parser.parse_args(
 )%0A%0A 
@@ -906,19 +906,9 @@
 args
-, options)%0A
+)
 %0A%0Aif

Adjust main command to argparse