Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. | |
| 2 # Use of this source code is governed by a BSD-style license that can be | |
| 3 # found in the LICENSE file. | |
| 4 | |
| 5 import argparse | |
| 6 from datetime import date | |
| 7 from datetime import timedelta | |
| 8 import os | |
| 9 | |
| 10 from crash_queries.crash_printer import crash_printer | |
| 11 | |
| 12 _DATETIME_FORMAT = '%Y-%m-%d' | |
| 13 _TODAY = date.today().strftime(_DATETIME_FORMAT) | |
| 14 _A_YEAR_AGO = (date.today() - timedelta(days=365)).strftime(_DATETIME_FORMAT) | |
| 15 | |
| 16 | |
| 17 if __name__ == '__main__': | |
| 18 argparser = argparse.ArgumentParser( | |
| 19 description='Print crashes.') | |
| 20 | |
| 21 argparser.add_argument( | |
| 22 '--since', | |
| 23 '--after', | |
|
stgao
2016/10/14 00:55:01
Why we have two names here?
Sharu Jiang
2016/10/14 18:14:49
This is similar to args of git log command:
http
stgao
2016/10/19 00:49:47
I rarely see such a usage.
What's the considerati
Sharu Jiang
2016/10/19 20:12:44
Maybe when people can not remember clearly whether
stgao
2016/10/20 01:18:37
When people don't remember, they should run "scrip
Sharu Jiang
2016/10/20 20:38:21
Acknowledged.
wrengr
2016/10/24 18:09:37
FWIW, I agree with stgao here. Having multiple way
| |
| 24 default=_A_YEAR_AGO, | |
| 25 help=('Query data since this date (including this date). ' | |
| 26 'Should be in YYYY-MM-DD format. E.g. 2015-09-31. ' | |
| 27 'Defaults to a year ago.')) | |
| 28 | |
| 29 argparser.add_argument( | |
| 30 '--until', | |
| 31 '--before', | |
|
stgao
2016/10/14 00:55:01
same here.
Sharu Jiang
2016/10/14 18:14:49
Ditto.
| |
| 32 default=_TODAY, | |
| 33 help=('Query data until this date (not including this date). ' | |
| 34 'Should be in YYYY-MM-DD format. E.g. 2015-09-31. ' | |
| 35 'Defaults to today.')) | |
| 36 | |
| 37 argparser.add_argument( | |
| 38 '--client', | |
| 39 '-c', | |
| 40 default='fracas', | |
| 41 help=('Possible values are: fracas, cracas, clusterfuzz. Right now, only ' | |
| 42 'fracas is supported.')) | |
| 43 | |
| 44 args = argparser.parse_args() | |
| 45 | |
| 46 crash_printer.CrashPrinter(args.client, | |
| 47 start_date=args.since, end_date=args.until, | |
| 48 app_id=os.getenv('APP_ID')) | |
| OLD | NEW |