Commit ab6cae21 authored by Vincent Pelletier's avatar Vincent Pelletier

Use option groups to make --help easier to read.

parent 90ba5e0e
...@@ -380,45 +380,52 @@ period_parser = { ...@@ -380,45 +380,52 @@ period_parser = {
} }
def main(): def main():
file_dir = os.path.abspath(os.path.dirname(__file__)) parser = argparse.ArgumentParser(description='Compute Apdex out of '
parser = argparse.ArgumentParser(description='Compute Apdex out of log files') 'apache-style log files')
parser.add_argument('logfile', nargs='+', parser.add_argument('logfile', nargs='+',
help='Log files to process') help='Log files to process')
parser.add_argument('-a', '--apdex', default=US_PER_S, type=int, parser.add_argument('-l', '--logformat',
default='%h %l %u %t "%r" %>s %O "%{Referer}i" "%{User-Agent}i" %D',
help='Apache LogFormat used to generate provided logs. '
'Default: %(default)r')
parser.add_argument('-o', '--out', default=os.getcwd(),
help='Directory in which statistic files will be generated. '
'Default: %(default)s')
parser.add_argument('-q', '--quiet', action='store_true',
help='Suppress warnings about malformed lines.')
parser.add_argument('--js',
default=os.path.abspath(os.path.dirname(__file__)),
help='Folder containing needed js files. Default: %(default)s')
group = parser.add_argument_group('generated content')
group.add_argument('-a', '--apdex', default=US_PER_S, type=int,
help='First threshold for Apdex computation, in microseconds. ' help='First threshold for Apdex computation, in microseconds. '
'Default: %(default)r') 'Default: %(default)r')
parser.add_argument('-e', '--error-detail', action='store_true', group.add_argument('-e', '--error-detail', action='store_true',
help='Include detailed report (url & referers) for error statuses.') help='Include detailed report (url & referers) for error statuses.')
parser.add_argument('-d', '--default', group.add_argument('-p', '--period', default='day', choices=period_parser,
help='Periodicity of sampling buckets. Default: %(default)r')
group.add_argument('-s', '--stats', action='store_true',
help='Enable parsing stats (time spent parsing input, time spent '
'generating output, ...)')
group.add_argument('--js-embed', action='store_true',
help='Embed js files instead of linking to them.')
group = parser.add_argument_group('site matching')
group.add_argument('-d', '--default',
help='Caption for lines matching no prefix, or skip them if not provided.') help='Caption for lines matching no prefix, or skip them if not provided.')
parser.add_argument('--base', dest='path', default=[], nargs='+', group.add_argument('--base', dest='path', default=[], nargs='+',
action=AggregateSiteUrl, action=AggregateSiteUrl,
help='Absolute base url of some part of a site (see also ' help='Absolute base url of some part of a site (see also '
'--erp5-base).') '--erp5-base).')
parser.add_argument('--erp5-base', dest='path', nargs='+', group.add_argument('--erp5-base', dest='path', nargs='+',
action=AggregateSiteUrl, action=AggregateSiteUrl,
help='Absolute base url of some part of an ERP5 site (extra ' help='Absolute base url of some part of an ERP5 site (extra '
'stats).') 'stats).')
parser.add_argument('--skip-base', dest='path', nargs='+', group.add_argument('--skip-base', dest='path', nargs='+',
action=AggregateSiteUrl, action=AggregateSiteUrl,
help='Absolute base url to ignore.') help='Absolute base url to ignore.')
parser.add_argument('-l', '--logformat',
default='%h %l %u %t "%r" %>s %O "%{Referer}i" "%{User-Agent}i" %D',
help='Apache LogFormat used to generate provided logs. '
'Default: %(default)r')
parser.add_argument('-o', '--out', default='.',
help='Directory in which statistic files will be generated. '
'Default: %(default)r')
parser.add_argument('-p', '--period', default='day', choices=period_parser,
help='Periodicity of sampling buckets. Default: %(default)r')
parser.add_argument('-q', '--quiet', action='store_true',
help='Suppress warnings about malformed lines.')
parser.add_argument('-s', '--stats', action='store_true',
help='Enable parsing stats (time taken to parse all files, ...)')
parser.add_argument('--js', default=file_dir,
help='Folder containing needed js files. Default: %(default)s')
parser.add_argument('--js-embed', action='store_true',
help='Embed js files instead of linking to them.')
args = parser.parse_args() args = parser.parse_args()
line_regex = '' line_regex = ''
try: try:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment