"""
Emulates a Travis CI run
"""
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals

import sys

import ga4gh.common
import ga4gh.common.utils as utils


class TravisSimulator(object):

    logStrPrefix = '***'
    yamlFileLocation = '.travis.yml'

    def parseTestCommands(self):
        yamlData = utils.getYamlDocument(self.yamlFileLocation)
        return yamlData['script']

    def runTests(self):
        testCommands = self.parseTestCommands()
        for command in testCommands:
            self.log('Running: "{}"'.format(command))
            utils.runCommand(command)
        self.log('SUCCESS')

    def log(self, logStr):
        utils.log("{0} {1}".format(self.logStrPrefix, logStr))


def run_tests_main():
    if len(sys.argv) >= 2 and sys.argv[1] == '--version':
        utils.log("GA4GH run_tests version {}".format(
            ga4gh.common.__version__))
        return
    travisSimulator = TravisSimulator()
    travisSimulator.runTests()

@@ -148,12 +148,20 @@
 ort 
-sys%0A
+ga4gh.common
 %0Aimp
@@ -168,32 +168,43 @@
 ort ga4gh.common
+.cli as cli
 %0Aimport ga4gh.co
@@ -804,98 +804,113 @@
     
-if len(sys.argv) %3E= 2 and sys.argv%5B1%5D == '--version':%0A        utils.log(
+parser = cli.createArgumentParser(%22runs tests for a ga4gh package%22)%0A    versionString = 
 %22GA4GH 
-r
+R
 un
-_
 tests 
-v
+V
 ersi
@@ -932,20 +932,16 @@
         
-   
- 
 ga4gh.co
@@ -957,32 +957,128 @@
 rsion__)
-)%0A        return
+%0A    parser.add_argument(%0A        %22--version%22, version=versionString, action=%22version%22)%0A    parser.parse_args()%0A
 %0A    tra

Add real cli to run_tests.py