# coding: utf-8

import argparse
import inspect
import sys

from . import __version__

def version(parser, args):
    """print the yaas version"""
    print "yaas version %s" % __version__

def hello(parser, args):
    """show an elephant"""
    print "                .-.._       "
    print "          __  /`     '.     "
    print "       .-'  `/   (   a \    "
    print "      /      (    \,_   \   "
    print "     /|       '---` |\ =|   "
    print "    ` \    /__.-/  /  | |   "
    print "       |  / / \ \  \   \_\  "
    print "       |__|_|  |_|__\       "

def main():
    parser = argparse.ArgumentParser(prog="yaas")
    subparsers = parser.add_subparsers(dest="command")

    commands = {
        'version' : version,
        'hello' : hello
        }

    for name, fn in commands.iteritems():
        subparsers.add_parser(name, help=inspect.getdoc(fn))

    args, extra = parser.parse_known_args(sys.argv[1:])

    commands[args.command](subparsers.choices[args.command], extra)


@@ -76,24 +76,79 @@
 _version__%0A%0A
+YAAS_VERSION = %22yaas version %7B0%7D%22.format(__version__)%0A%0A
 def version(
@@ -209,39 +209,20 @@
 int 
-%22yaas version %25s%22 %25 __version__
+YAAS_VERSION
 %0A%0Ade
@@ -662,16 +662,173 @@
 %22yaas%22)%0A
+%0A    parser.add_argument(%0A        '-v',%0A        '--version',%0A        action='version',%0A        version=YAAS_VERSION,%0A        help=%22print the yaas version%22)%0A%0A
     subp

Version should be an argument and subcommand of yaas