#!/usr/bin/env python3

import shutil

import common

class Main(common.LkmcCliFunction):
    def __init__(self):
        super().__init__(
            description='''\
Run android AOSP on the AOSP pre-build emulator.

https://cirosantilli.com/linux-kernel-module-cheat#android
''',
        )
        self.add_argument('extra-emulator-args', default='', nargs='?')

    def timed_main(self):
            self.sh.run_cmd('{}emulator -show-kernel -verbose {}'.format(
                self.env['android_shell_setup'],
                self.env['extra_emulator_args']
            ),
            cwd=self.env['android_dir'],
            executable=shutil.which('bash'),
            shell=True,
        )

if __name__ == '__main__':
    Main().cli()
