@@ -71,15 +71,21 @@ def _valid_date(arg):
7171def _get_parser ():
7272 # Logging
7373 logging_args = argparse .ArgumentParser (add_help = False )
74- logging_args .add_argument ('-v' , '--verbose' , action = 'count' , default = 0 ,
75- help = 'Be verbose. Use `-vv` for increased verbosity.' )
76- logging_args .add_argument ('-l' , '--logfile' ,
77- help = 'If given, file where the logs will be written.' )
74+ logging_args .add_argument (
75+ '-v' ,
76+ '--verbose' ,
77+ action = 'count' ,
78+ default = 0 ,
79+ help = 'Be verbose. Use `-vv` for increased verbosity.' ,
80+ )
81+ logging_args .add_argument (
82+ '-l' , '--logfile' , help = 'If given, file where the logs will be written.'
83+ )
7884
7985 parser = argparse .ArgumentParser (
8086 prog = 'download-analytics' ,
8187 description = 'Download Analytics Command Line Interface' ,
82- parents = [logging_args ]
88+ parents = [logging_args ],
8389 )
8490 parser .set_defaults (action = None )
8591 action = parser .add_subparsers (title = 'action' )
@@ -90,36 +96,67 @@ def _get_parser():
9096 collect .set_defaults (action = _collect )
9197
9298 collect .add_argument (
93- '-o' , '--output-folder' , type = str , required = False ,
99+ '-o' ,
100+ '--output-folder' ,
101+ type = str ,
102+ required = False ,
94103 help = (
95104 'Path to the folder where data will be stored. It can be a local path or a'
96105 ' Google Drive folder path in the format gdrive://<folder-id>'
97- )
106+ ),
98107 )
99108 collect .add_argument (
100- '-a' , '--authentication-credentials' , type = str , required = False ,
101- help = 'Path to the GCP (BigQuery) credentials file to use.' )
109+ '-a' ,
110+ '--authentication-credentials' ,
111+ type = str ,
112+ required = False ,
113+ help = 'Path to the GCP (BigQuery) credentials file to use.' ,
114+ )
102115 collect .add_argument (
103- '-c' , '--config-file' , type = str , default = 'config.yaml' ,
104- help = 'Path to the configuration file.' )
116+ '-c' ,
117+ '--config-file' ,
118+ type = str ,
119+ default = 'config.yaml' ,
120+ help = 'Path to the configuration file.' ,
121+ )
105122 collect .add_argument (
106- '-p' , '--projects' , nargs = '*' ,
107- help = 'List of projects to collect. If not given use the configured ones.' )
123+ '-p' ,
124+ '--projects' ,
125+ nargs = '*' ,
126+ help = 'List of projects to collect. If not given use the configured ones.' ,
127+ )
108128 collect .add_argument (
109- '-s' , '--start-date' , type = _valid_date , required = False ,
110- help = 'Date from which to start pulling data.' )
129+ '-s' ,
130+ '--start-date' ,
131+ type = _valid_date ,
132+ required = False ,
133+ help = 'Date from which to start pulling data.' ,
134+ )
111135 collect .add_argument (
112- '-m' , '--max-days' , type = int , required = False ,
113- help = 'Max days of data to pull if start-date is not given.' )
136+ '-m' ,
137+ '--max-days' ,
138+ type = int ,
139+ required = False ,
140+ help = 'Max days of data to pull if start-date is not given.' ,
141+ )
114142 collect .add_argument (
115- '-d' , '--dry-run' , action = 'store_true' ,
116- help = 'Do not run the actual query, only simulate it.' )
143+ '-d' ,
144+ '--dry-run' ,
145+ action = 'store_true' ,
146+ help = 'Do not run the actual query, only simulate it.' ,
147+ )
117148 collect .add_argument (
118- '-f' , '--force' , action = 'store_true' ,
119- help = 'Force the download even if the data already exists or there is a gap' )
149+ '-f' ,
150+ '--force' ,
151+ action = 'store_true' ,
152+ help = 'Force the download even if the data already exists or there is a gap' ,
153+ )
120154 collect .add_argument (
121- '-M' , '--add-metrics' , action = 'store_true' ,
122- help = 'Compute the aggregation metrics and create the corresponding spreadsheets.' )
155+ '-M' ,
156+ '--add-metrics' ,
157+ action = 'store_true' ,
158+ help = 'Compute the aggregation metrics and create the corresponding spreadsheets.' ,
159+ )
123160
124161 return parser
125162
0 commit comments