11import argparse
22import git_logger
3-
3+ import export_sheets
44
55def parse_args ():
66 parser = argparse .ArgumentParser ()
77 parser .add_argument ("-p" , help = "log pull requests" , action = "store_true" )
88 parser .add_argument ("-i" , help = "log issues" , action = "store_true" )
9+ parser .add_argument ("-e" , help = "log issues" , action = "store_true" )
910 parser .add_argument ('-t' , '--token' , type = str , required = True , help = 'token github account' )
1011 parser .add_argument ('-l' , '--list' , type = str , required = True , help = 'repos names file' )
1112 parser .add_argument ('-o' , '--out' , type = str , required = True , help = 'output filename' )
13+ parser .add_argument ('--google_token' , type = str , required = False , help = 'Specify path to google token file' )
14+ parser .add_argument ('--table_id' , type = str , required = False ,
15+ help = 'Specify Google sheet document id (can find in url)' )
16+ parser .add_argument ('--sheet_id' , type = str , required = False ,
17+ help = 'Specify title for a sheet in a document in which data will be printed' )
18+ args = parser .parse_args ()
19+ if args .e :
20+ for action in parser ._actions :
21+ if action .dest == 'google_token' :
22+ action .required = True
23+ if action .dest == 'table_id' :
24+ action .required = True
25+ if action .dest == 'sheet_id' :
26+ action .required = True
1227 return parser .parse_args ()
1328
1429
@@ -25,10 +40,17 @@ def main():
2540 else :
2641 if not args .p and not args .i :
2742 git_logger .log_commits (client , repositories , csv_name )
43+ if (args .e ):
44+ export_sheets .write_data_to_table (csv_name , args .google_token , args .table_id , args .sheet_id )
2845 if args .p :
2946 git_logger .log_pull_requests (client , repositories , csv_name )
47+ if (args .e ):
48+ export_sheets .write_data_to_table (csv_name , args .google_token , args .table_id , args .sheet_id )
3049 if args .i :
3150 git_logger .log_issues (client , repositories , csv_name )
51+ if (args .e ):
52+ export_sheets .write_data_to_table (csv_name , args .google_token , args .table_id , args .sheet_id )
53+
3254
3355
3456if __name__ == '__main__' :
0 commit comments