perf/aggregate: use Getopt::Long for option parsing
commit38368cba2650bc51570356dfd660dfe192164082
authorChristian Couder <christian.couder@gmail.com>
Wed, 25 Apr 2018 16:10:25 +0000 (25 18:10 +0200)
committerJunio C Hamano <gitster@pobox.com>
Thu, 26 Apr 2018 02:07:16 +0000 (26 11:07 +0900)
treebe3a8ced07d86c0a9eb4f370b62a01e9ad02d136
parent1f1cddd558b54bb0ce19c8ace353fd07b758510d
perf/aggregate: use Getopt::Long for option parsing

When passing an option '--foo' that it does not recognize, the
aggregate.perl script should die with an helpful error message
like:

Unknown option: foo
./aggregate.perl [options] [--] [<dir_or_rev>...] [--] \
[<test_script>...] >

  Options:
    --codespeed          * Format output for Codespeed
    --reponame    <str>  * Send given reponame to codespeed
    --sort-by     <str>  * Sort output (only "regression" \
criteria is supported)

rather than:

  fatal: Needed a single revision
  rev-parse --verify --foo: command returned error: 128

To implement that let's use Getopt::Long for option parsing
instead of the current manual and sloppy parsing. This should
save some code and make option parsing simpler, tighter and
safer.

This will avoid something like 'foo--sort-by=regression' to
be handled as if '--sort-by=regression' had been used, for
example.

As Getopt::Long eats '--' at the end of options, this changes
a bit the way '--' is handled as we can now have '--' both
after the options and before the scripts.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/perf/aggregate.perl