######## # Main # ######## if __name__ == '__main__': parser = argparse.ArgumentParser() parser.add_argument('command', choices=['run', 'watch', 'status', 'info']) parser.add_argument('build_type_id', nargs='*', help='build type ids to operate on') args = parser.parse_args() btids = args.build_type_id or get_all_bts() if args.command == 'run': for x in btids: tc.trigger_build(x) print('Builds triggered: {}'.format(btids)) elif args.command == 'watch': watch_builds(btids) elif args.command == 'status': for x in btids: print_build(get_last_build(x)) print(end='\n\n') elif args.command == 'info': info = tc.get_server_info() print('Teamcity {}\n{}\n'.format(info['version'], tc.base_base_url)) print_build_types(btids)