# -*- coding: utf-8 -*-
import os
import argparse
import subprocess
from core import Project
from template.license_tmpl import candidate


class CLI(object):
    def __init__(self):
        try:
            author = subprocess.check_output(
                'git config --get user.name'.split()).rstrip()
            email = subprocess.check_output(
                'git config --get user.email'.split()).rstrip()
            self.git_enabled = True
        except:
            print('git is not enabled')
            author = ''
            email = ''
            self.git_enabled = False

        self.parser = argparse.ArgumentParser(
            formatter_class=argparse.RawTextHelpFormatter)
        self.parser.add_argument('name', type=str, help='project name')
        self.parser.add_argument(
            '--author',
            type=str,
            metavar='author',
            nargs='?',
            help='author name (default: git user.name)',
            default=author)
        self.parser.add_argument(
            '--email',
            type=str,
            metavar='email',
            dest='author_email',
            nargs='?',
            help='author email (default: git user.email)',
            default=email)
        self.parser.add_argument(
            '--license',
            type=str,
            metavar='license',
            dest='licence',
            nargs='?',
            choices=candidate.keys(),
            help='license (default: MIT)\n{}'.format(candidate.keys().__str__(
            )),
            default='MIT')

    def run(self):
        args = self.parser.parse_args().__dict__
        project = Project(**args)
        project.make()
        if self.git_enabled:
            with open(os.path.devnull, 'w') as fp:
                subprocess.call(
                    'git init {}'.format(args['name']).split(),
                    stdout=fp,
                    stderr=subprocess.STDOUT)


def main():
    cli = CLI()
    cli.run()


if __name__ == '__main__':
    main()

@@ -130,16 +130,42 @@
 ndidate%0A
+from . import __version__%0A
 %0A%0Aclass 
@@ -656,16 +656,126 @@
 Parser(%0A
+            prog='python-starter',%0A            usage='%25(prog)s %5Boptions%5D target',%0A            add_help=False,%0A
         
@@ -825,16 +825,65 @@
 matter)%0A
+        self.parser._optionals.title = 'options'%0A
         
@@ -934,22 +934,25 @@
 elp=
-'project name'
+argparse.SUPPRESS
 )%0A  
@@ -1739,16 +1739,281 @@
 t='MIT')
+%0A        self.parser.add_argument(%0A            '--version',%0A            action='version',%0A            version='%25(prog)s %7Bversion%7D'.format(version=__version__))%0A        self.parser.add_argument(%0A            '--help', action='help', help='show this message and exit')
 %0A%0A    de

Update CLI