#NEWLINE# def validate_args( args ) : #NEWLINE# #INDENT# if ( ( len ( args . command ) == 0 ) or ( len ( args . git_uri ) == 0 ) ) : #NEWLINE# #INDENT# print ( 'Please input for --test-cmd and --git-uri' ) #NEWLINE# exit ( 1 ) #NEWLINE# #UNINDENT# pat = re . compile ( 'github\\.com[:/](.+?)/(.+?)($|/.*$|\\.git$|\\.git/.*$)' ) #NEWLINE# match = pat . search ( args . git_uri ) #NEWLINE# if match : #NEWLINE# #INDENT# user_org_name = match . group ( 1 ) #NEWLINE# repo = match . group ( 2 ) #NEWLINE# if args . public : #NEWLINE# #INDENT# correct_uri = ( 'https://github.com/%s/%s' % ( user_org_name , repo ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# correct_uri = ( 'git@github.com:%s/%s.git' % ( correct_uri , repo ) ) #NEWLINE# #UNINDENT# return correct_uri #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# print ( 'The input git uri seems not right' ) #NEWLINE# if args . public : #NEWLINE# #INDENT# print ( 'The correct format is: https://github.com/<USER>/<REPO>' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# print ( 'The correct format is: git@github.com:<USER>/<REPO>.git' ) #NEWLINE# #UNINDENT# exit ( 1 )