def RunInteractivePrompt(client_secret, output_path):
    input = ''
    while True:
        print 'u upload'
        print 'g get upload status'
        print 't publish trusted tester'
        print 'p publish public'
        print 'q quit'
        input = raw_input('Please select an option: ')
        input = input.strip()
        if input == 'g':
            print(
                'Upload status: %s' %
                webstore_extension_util.GetUploadStatus(client_secret).read())
        elif input == 'u':
            print(
                'Uploaded with status: %s' %
                webstore_extension_util.PostUpload(output_path.name,
                                                   client_secret))
        elif input == 't':
            print(
                'Published to trusted testers with status: %s' %
                webstore_extension_util.PostPublishTrustedTesters(
                    client_secret).read())
        elif input == 'p':
            print('Published to public with status: %s' %
                  webstore_extension_util.PostPublish(client_secret).read())
        elif input == 'q':
            sys.exit()
        else:
            print 'Unrecognized option: %s' % input
def main():
    options, args = CreateOptionParser().parse_args()
    if len(args) < 1 or not options.client_secret:
        print 'Expected at least one argument and --client_secret flag'
        print str(args)
        sys.exit(1)

    client_secret = options.client_secret

    for extension in args:
        webstore_extension_util.g_app_id, extension_path = extension.split(':')
        output_path = tempfile.NamedTemporaryFile()
        extension_path = os.path.expanduser(extension_path)

        is_chromevox = webstore_extension_util.g_app_id == _CHROMEVOX_ID

        with ZipFile(output_path, 'w') as zip:
            for root, dirs, files in os.walk(extension_path):
                rel_path = os.path.join(os.path.relpath(root, extension_path),
                                        '')

                if is_chromevox and rel_path in EXCLUDE_PATHS:
                    continue

                for extension_file in files:
                    if is_chromevox and extension_file in EXCLUDE_PATHS:
                        continue

                    zip.write(os.path.join(root, extension_file),
                              os.path.join(rel_path, extension_file))

            if is_chromevox:
                manifest_file = MakeChromeVoxManifest()
                zip.write(manifest_file.name, 'manifest.json')

        print 'Created extension zip file in %s' % output_path.name
        print 'Please run manual smoke tests before proceeding.'
        if options.publish:
            print(
                'Uploading...%s' % webstore_extension_util.PostUpload(
                    output_path.name, client_secret))
            print('publishing...%s' %
                  webstore_extension_util.PostPublish(client_secret).read())
        else:
            RunInteractivePrompt(client_secret, output_path)